Copying an uploaded file...

From: Date: Wed, 29 Oct 2003 17:19:02 +0000
Subject: Copying an uploaded file...
Groups: php.general 
Request: Send a blank email to php-general+get-168029@lists.php.net to get a copy of this message
I'm trying to get a little upload script working... But I can't seem to copy the tmp file to my local web directory (btw, do I really need to specify the path, or can I just use a filename, and the file will be written to the same directory as the PHP script??). Anyway, here is the code: $realname = $_FILES['userfile']['name']; if(copy($_FILES['userfile']['tmp_name'], '/Users/rene/Sites/renefournier/titan/res/'.$realname)) { echo $realname.' uploaded'; } else { echo $realname.' could not be uploaded'; } echo '<br>'; echo "name: ".$_FILES[$fld]['name']; echo '<br>'; echo "type: ".$_FILES[$fld]['type']; echo '<br>'; echo "size: ".$_FILES[$fld]['size']; echo '<br>'; echo "tmp: ".$_FILES[$fld]['tmp_name']; echo '<br>'; Here is the output: could not be uploaded name: web_share.gif type: image/gif size: 13370 tmp: /var/tmp/phpNqigbO Thanks for any ideas.

« previous php.general (#168029) next »