php file upload error

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
    I'm trying to get the below script working, adapted from the manual on Although i am getting success file uploading, i do not see the file
in the tempoary area. And i'm not sure where to go as the server confirms
file uploaded successfully. Any help appreciated.


    if (count($_FILES))
 var_dump($_FILES) ;

    if (is_uploaded_file($_FILES['UploadFile']['tmp_name']))
        print "<h3>File successfully uploaded.</h3>" ;
 print "<a href=\"\">Upload Another?<br>" ;
 print <<< __HTMLFORM__
<form enctype="multipart/form-data" action=""
<input type="hidden" name="MAX_FILE_SIZE" value="10290000">
Filename:  <input name="UploadFile" type="file">
<input type="submit" value="upload">
 print "<br><a href=\"\">Upload Another?<br>" ;


Re: php file upload error

dave wrote:
Quoted text here. Click to load it

PHP automatically removes the uploaded file from the temporary directory
when the script ends. You have to put the file somewhere else while you
have control over it.

Quoted text here. Click to load it

See these links:

Quoted text here. Click to load it

Mail to my "From:" address is readable by all at /
== ** ## !! ------------------------------------------------ !! ## ** ==
may bypass my spam filter. If it does, I may reply from another address!

Re: php file upload error

Hi Dave

From the PHP Help file - handling file uploads section:

"The file will be deleted from the temporary directory at the end of the
request if it has not been moved away or renamed."

use     copy($userfile, "/place/to/put/uploaded/file");

or similar to move the file (or just rename it), then you will be able to
see it.

Paul Barfoot

Quoted text here. Click to load it

Site Timeline