note 99455 added to features.file-upload.post-method

From: Date: Wed, 18 Aug 2010 15:41:21 +0000
Subject: note 99455 added to features.file-upload.post-method
Groups: php.notes 
Request: Send a blank email to php-notes+get-171801@lists.php.net to get a copy of this message
You can only move the uploaded file once. <?php // RAY_temp_upload_example.php error_reporting(E_ALL); echo "<pre>" . PHP_EOL; // IF A FILE HAS BEEN UPLOADED if (!empty($_FILES)) { // SHOW THE UPLOADED FILES print_r($_FILES); // TRY TO MOVE THE FILE TWICE - SECOND MOVE RETURNS FALSE if (!move_uploaded_file($_FILES["userfile"]["tmp_name"], $_FILES["userfile"]["name"])) echo "CANNOT MOVE {$_FILES["userfile"]["name"]}" . PHP_EOL; if (!move_uploaded_file($_FILES["userfile"]["tmp_name"], $_FILES["userfile"]["name"])) echo "CANNOT MOVE {$_FILES["userfile"]["name"]}" . PHP_EOL; // SHOW THE UPLOADED FILES AFTER THE MOVE - NO VISIBLE CHANGE print_r($_FILES); } // END OF PHP, PUT UP THE HTML FORM TO GET THE FILE ?> <!-- The data encoding type, enctype, MUST be specified as below --> <form enctype="multipart/form-data" method="POST"> <!-- MAX_FILE_SIZE must precede the file input field --> <input type="hidden" name="MAX_FILE_SIZE" value="300000" /> <!-- Name of input element determines name in $_FILES array --> Send this file: <input name="userfile" type="file" /> <input type="submit" value="Send File" /> </form> ---- Server IP: 64.71.164.2 Probable Submitter: 98.169.58.122 ---- Manual Page -- http://www.php.net/manual/en/features.file-upload.post-method.php Edit -- https://master.php.net/note/edit/99455 Del: integrated -- https://master.php.net/note/delete/99455/integrated Del: useless -- https://master.php.net/note/delete/99455/useless Del: bad code -- https://master.php.net/note/delete/99455/bad+code Del: spam -- https://master.php.net/note/delete/99455/spam Del: non-english -- https://master.php.net/note/delete/99455/non-english Del: in docs -- https://master.php.net/note/delete/99455/in+docs Del: other reasons-- https://master.php.net/note/delete/99455 Reject -- https://master.php.net/note/reject/99455 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#171801) next »