File upload problem
| From: | Ignatius Teo | Date: | Mon, 19 Jun 2000 14:56:14 +0000 |
| Subject: | File upload problem | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-528@lists.php.net to get a copy of this message | ||
Hi all,
I have a script that does a file upload.
If the form enctype is application/x-www-form-urlencoded, eveything's cool
and HTTP_POST_VARS returns this:
$HTTP_POST_VARS[MyFile]=D:\php3\Examples\test.txt
But if the form enctype is multipart/form the filename variable is set to
the upload_dir setting in php.ini (in this case c:/temp - the \\php2 gets
tacked on the end and it appears to be some sort of counter inserted by the
php intepreter). HTTP_POST_VARS returns this:
$HTTP_POST_VARS[MyFile]=c:/temp\php2
On dumping all HTTP_POST_VARS, I get:
MyFile_name,test.txt
MyFile,c:/temp\\php2
MyFile_size,1868
submit,submit
And because my destination file is set to:
$upload_dir = "d:/temp";
$MyFile = stripslashes($HTTP_POST_VARS[MyFile]);
$destFile = $upload_dir.basename($MyFile);
I end up with a filename:
$destFile=d:/Temp/temp\php2
And thus I get an error:
Warning: Unable to create 'd:/Temp/temp\php2': No such process in
d:\php3\examples \fileupload.php3 on line 20
Error uploading file to d:/Temp/temp\php2
Is this a bug? Or am I missing something? I ask because I'd like to be able
to use the "MyFile_size" variable that's automatically returned.
Ignatius
PS: Apache 1.3.12, PHP3 CGI or PHP4 CGI or mod (doesn't make a diff), Win98.