note 15651 deleted from function.move-uploaded-file by jimw

From: Date: Sat, 08 Dec 2001 19:20:28 +0000
Subject: note 15651 deleted from function.move-uploaded-file by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-22095@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">

« previous php.notes (#22095) next »