Query: move_uploaded_file
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
MOVE_UPLOADED_FILE(3) 1 MOVE_UPLOADED_FILE(3) move_uploaded_file - Moves an uploaded file to a new locationSYNOPSISbool move_uploaded_file (string $filename, string $destination)DESCRIPTIONThis function checks to ensure that the file designated by $filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by $destination. This sort of check is especially important if there is any chance that anything done with uploaded files could reveal their contents to the user, or even to other users on the same system.PARAMETERSo $filename - The filename of the uploaded file. o $destination - The destination of the moved file.RETURN VALUESReturns TRUE on success. If $filename is not a valid upload file, then no action will occur, and move_uploaded_file(3) will return FALSE. If $filename is a valid upload file, but cannot be moved for some reason, no action will occur, and move_uploaded_file(3) will return FALSE. Additionally, a warning will be issued.EXAMPLESExample #1 Uploading multiple files <?php $uploads_dir = '/uploads'; foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, "$uploads_dir/$name"); } } ?>NOTESNote move_uploaded_file(3) is both safe mode and open_basedir aware. However, restrictions are placed only on the $destination path as to allow the moving of uploaded files in which $filename may conflict with such restrictions. move_uploaded_file(3) ensures the safety of this operation by allowing only those files uploaded through PHP to be moved. Warning If the destination file already exists, it will be overwritten.SEE ALSOis_uploaded_file(3), rename(3), See Handling file uploads for a simple usage example. PHP Documentation Group MOVE_UPLOADED_FILE(3)
Related Man Pages |
---|
php_check_syntax(3) - php |
dput.cf(5) - linux |
mongogridfsexception(3) - php |
copy(3) - php |
oci_new_descriptor(3) - php |
Similar Topics in the Unix Linux Community |
---|
User CP Options |
explanation for "if [ -s $filename ];" |
Getting error |
using find command |
How to create a cron job to take an uploaded filename and move it? |