mothermugger Posted March 30, 2009 Share Posted March 30, 2009 Hi there. I am on a mission to create a file upload project for my friend in NY who has a real need for a slick multiple file upload interface on a Linux server. I have made real progress and found a great front end using jquery.multi-file-upload.js See this link: http://www.fyneworks.com/jquery/multiple-file-upload/# for details. This slick little java thing works great! See my test bed here: http://www.crossroadsonthecoast.com/multi-uploads/choosefiles2.htm but I am having trouble with the PHP part that uses the FILE ARRAY, Here is the PHP code: <?php echo '<pre>'; if(count($_FILES) > 0) { $arrfile = pos($_FILES); $uploadfile = $uploaddir . basename($arrfile['name']); if (move_uploaded_file ($arrfile['tmp_name'], $uploadfile)) echo "File is valid, and was successfully uploaded.\n"; } else echo 'No files sent. Script is OK!'; //Say to Flash that script exists and can receive files echo 'Here is some more debugging info:'; print_r($_FILES); echo "</pre>"; ?> Now here is my output (error) but note it shows the array contents! (this print_r($_FILES); never worked in previous trys..) Warning: basename() expects parameter 1 to be string, array given in /home/content/s/p/e/spencedave/html/multi-uploads/multi-uploader.php on line 13 Here is some more debugging info:Array ( [uploadedfile] => Array ( [name] => Array ( [0] => [1] => refi-1.txt [2] => bills paid.pdf ) [type] => Array ( [0] => [1] => text/plain [2] => application/pdf ) [tmp_name] => Array ( [0] => [1] => /tmp/phpbdBpjy [2] => /tmp/phpVIq3rp ) [error] => Array ( [0] => 4 [1] => 0 [2] => 0 ) => Array ( [0] => 0 [1] => 228 [2] => 56671 ) ) ) I note that the [0] element has no file name - this is due to the nature of the file upload field, as the array is built that filed is always blank so on submit it's blank unless you type something in there yourself. Any help on the debug would be great! Link to comment https://forums.phpfreaks.com/topic/151750-solved-multi-file-upload-php-_file-array-debug/ Share on other sites More sharing options...
Brian W Posted March 30, 2009 Share Posted March 30, 2009 if you use the code tags you will likely get more help [ code ]Like this but without the spaces in the tags[ /code ] would be Like this but without the spaces in the tags Link to comment https://forums.phpfreaks.com/topic/151750-solved-multi-file-upload-php-_file-array-debug/#findComment-796868 Share on other sites More sharing options...
mothermugger Posted April 18, 2009 Author Share Posted April 18, 2009 Thanks for all the help! I was able to solve the mystery and now have a very cool AJAX multi file upload project that uses PHP. Check out my demo here: http://www.ezwayweb.com/upload_multiple_files_PHP_sample_code.htm Link to comment https://forums.phpfreaks.com/topic/151750-solved-multi-file-upload-php-_file-array-debug/#findComment-813105 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.