Hi folks,
I still have the problem with whitespaces:
I have an uploadform for users to upload mp3-files. It works fine, except when there are whitespaces in the filename. At the moment I tell the user not to use Filenames with whitespaces, but apparently its very common to use them in mp3s. So I would like to solve this problem. What happens is this:
Normally:
A user selects a file without whitespaces with an html file-input form:
<form method="post" enctype="multipart/form-data" name="form2" id="form2" action="' . $_SERVER[PHP_SELF] . '">
<input type="file" style="color:#888888" name="file" id="file" />
Then, on the serverside I handle the file with
copy($_FILES['file']['tmp_name'], $newfilename);
This works fine.
NOT normally:
A user selects a file with whitespace in the filename. The print_r($_POST) looks like this:
Array ( [x] => 21 [y] => 32 )
And the print_R($_FILES) looks like this:
Array ( [file] => Array ( [name] => 11. test with spaces.mp3 [type] => [tmp_name] => [error] => 1 [size] => 0 ) )
As the tmp_name is empty, the script can't acess the file and there we have an ugly error... So what I think I need is to manipulate the [tmp_name], so that it has no whitespaces, because my Apache/Linux Server seems to have a problem with it. Has anyone any ideas how to solve this?
Greetz and Thanks
Maenny