Sorry about that guys, here is a bit more info that might be useful:

I forgot to tell you that I'm working on a Windows XP box with full rights,
which means the default temporary directory is C:\WINDOWS\Temp and there are
no limitations on what I can and cannot access on the system (running as
system administrator). I did change that default to C:\PHP\tmp_uploads. I
ran this script with the default temp directory as well, same result.

I tried the code at
and listed the results of the test below. I simplified the code a little,
and here it is:

if ($submit) {
   if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
       echo "The temporary file exists";
   } else {
       echo "Possible file upload attack.";
   echo  "<br> Filename: " . $_FILES['userfile']['name']
       . "<br> Mime-Type: " . $_FILES['userfile']['type']
       . "<br> File Size: " . $_FILES['userfile']['size'] . " bytes"
       . "<br> Temporary File Name: " . $_FILES['userfile']['tmp_name']
       . "<br> Error: " . $_FILES['userfile']['error'];
} else {


<form enctype="multipart/form-data" action="img_upload.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
Send this file: <input name="userfile" type="file">
<input type="submit" name="submit" value="submit">

<?php } ?>

Here is what's happening:

2. When the submit button is pushed, the files are uploaded through the form
but the temporary file is never created on the system. I did a search on the
entire C: drive for the temporary file that should have been created, but
it's not there.

Here is the data received after the file is supposedly uploaded with a GIF
The temporary file exists
Filename: icon_processing.gif
Mime-Type: image/gif
File Size: 408 bytes
Temporary File Name: C:/PHP/tmp_uploads\php93.tmp
Error: 0

Here is the data received after the file is supposedly uploaded with a JPG
The temporary file exists
Filename: Sunset.jpg
Mime-Type: image/pjpeg
File Size: 71189 bytes
Temporary File Name: C:/PHP/tmp_uploads\php95.tmp
Error: 0

NOTE: The error code 0 means that there was no error uploading the file.

THE QUESTION: Shouldn't PHP automatically create a temporary file of the
uploaded image? Is there something I'm missing in the php.ini settings?

If you have any other questions that might help you further your probe into
this problem, please let me know. Thanks...

- Darwin


> Ok, I have a problem with my file upload. When I upload a file, say $img,
> only $img is available and when I echo $img to the screen it gives the
> path of the temporary image "supposedly" created by PHP. Echoing
> $_FILE['img']['tmp_name'], or any of the other $_FILE array elements,
> doesn't give anything. There is no array of information for the uploaded
> file, possibly because of the following problem I'm having:
> Another weird thing is that no temporary file is even created on the
> (I did a system search on the C: drive of the windows box I'm using). Here
> is the info from my php.ini file:
> --------------------------------------------------------------------------
> ---
> ;;;;;;;;;;;;;;;;
> ; File Uploads ;
> ;;;;;;;;;;;;;;;;
> ; Whether to allow HTTP file uploads.
> file_uploads = On
> ; Temporary directory for HTTP uploaded files (will use system default if
> not
> ; specified).
> upload_tmp_dir = C:\PHP\tmp_uploads
> ; Maximum allowed size for uploaded files.
> upload_max_filesize = 6M
> --------------------------------------------------------------------------
> ----
> I even changed the upload_tmp_dir setting to the default and it still
> create a temporary file of the image on the server. GD is definately
> installed and enabled according to phpinfo() -- although GD has nothing to
> do with this. I'm uploading *.jpg/*.jpeg files only. register_globals is
> (I am aware of the risks). So what could be wrong? Is there another
> in the php.ini file that I need to worry about that is not set by default?
> I've pondered and tested this long enough and I'm beyond frustration,
> someone please help me with some suggestions to get me through this...
> Thanks,
> - Darwin

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to