note 15651 added to function.move-uploaded-file

From: Date: Tue, 25 Sep 2001 07:39:55 +0000
Subject: note 15651 added to function.move-uploaded-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-18270@lists.php.net to get a copy of this message
Here is a very simple code snippet for uploading files to your temp dir (specified in php.ini) and copying them over to a new folder while ensuring it has the same name and extension. Assume the form data was posted to this script... <?php if ($userfile != "none") { copyfile($userfile, $userfile_name); } else { echo "please select a file."; } function copyfile ($userfile, $userfile_name) { if (is_uploaded_file($userfile)) { copy $userfile, "c:\\your_dir\\$userfile_name"); } else { echo "Could not copy."; } } ?> This also assumes that you input tag from the form was... <input type="file" name="userfile"> -- http://www.php.net/manual/en/function.move-uploaded-file.php http://master.php.net/manage/user-notes.php?action=edit+15651 http://master.php.net/manage/user-notes.php?action=delete+15651 http://master.php.net/manage/user-notes.php?action=reject+15651

« previous php.notes (#18270) next »