note 13056 deleted from features.file-upload by irc-html

From: Date: Sat, 19 Jan 2002 20:33:26 +0000
Subject: note 13056 deleted from features.file-upload by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25352@lists.php.net to get a copy of this message
The examples given above do not work for php4.0.4. You have to use the tmp_name rather than the name. The actual command sequence to check if the file has uploaded and then move it to where you need it is something like: // Pull out the information about this upload. // You don't need type or size unless you want them. $userfile = $HTTP_POST_FILES['userfile']['name']; $type = $HTTP_POST_FILES['userfile']['type']; $size = $HTTP_POST_FILES['userfile']['size']; $location = $HTTP_POST_FILES['userfile']['tmp_name']; // If the upload was successful, then move the tmp file. // Subsitute ./tmp/$userfile to whatever directory/file you want. // moveFailed() - whatever you want here to handle move failure. if($userfile and is_uploaded_file($location)) { move_uploaded_file($location, "./tmp/$userfile") or moveFailed(); } One more thing - PHP deletes the temporary file if you don't move it, so don't expect to test the upload by checking the file is on the system like I did. Thanks for making that clear in the manual! E-me is you need assistance with this. Stewart.

« previous php.notes (#25352) next »