note 110902 added to features.file-upload

From: Date: Fri, 21 Dec 2012 06:27:44 +0000
Subject: note 110902 added to features.file-upload
Groups: php.notes 
Request: Send a blank email to php-notes+get-192626@lists.php.net to get a copy of this message
create $_FILES array from list of files in a directory <?php $_FILES = array(); $i = 0; $tempDir = "/upload/"; foreach (glob($tempDir . "*") as $filename) { if (filetype($filename) == 'dir') continue; if ($filename == '.' || $filename == '..') continue; $_FILES['file']['name'] [$i] = pathinfo($filename, PATHINFO_BASENAME); $_FILES['file']['type'] [$i] = mime_content_type($filename); $_FILES['file']['tmp_name'] [$i] = $filename; $_FILES['file']['error'] [$i] = UPLOAD_ERR_OK; $_FILES['file']['size'] [$i] = filesize($filename); $i++; } ?> * You sure installed fileinfo pecl extension * Forgot that about this created array, is_uploaded_file function return false and you can not use move_uploaded_file function for save as file, so you just can use copy function for save tmp_name ---- Server IP: 69.147.83.199 Probable Submitter: 199.201.126.207 ---- Manual Page -- http://php.net/manual/en/features.file-upload.php Edit -- https://master.php.net/note/edit/110902 Del: integrated -- https://master.php.net/note/delete/110902/integrated Del: useless -- https://master.php.net/note/delete/110902/useless Del: bad code -- https://master.php.net/note/delete/110902/bad+code Del: spam -- https://master.php.net/note/delete/110902/spam Del: non-english -- https://master.php.net/note/delete/110902/non-english Del: in docs -- https://master.php.net/note/delete/110902/in+docs Del: other reasons-- https://master.php.net/note/delete/110902 Reject -- https://master.php.net/note/reject/110902 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#192626) next »