OtagoHarbour Posted May 2, 2011 Share Posted May 2, 2011 I started with the following code from here http://www.w3schools.com/TAGS/tag_select.asp.<form action="upload_file.php" method="post"enctype="multipart/form-data"><label for="file">Filename:</label><input type="file" name="file" id="file" /><br /><input type="submit" name="submit" value="Submit" /></form>However the browser window only lets me select one file. Is there a way to make it so that the user can select several files at once in the browser? I would like a method that is browser and OS independent.Thanks,Peter. Link to comment Share on other sites More sharing options...
jeffman Posted May 2, 2011 Share Posted May 2, 2011 Sorry, not yet. Fully implemented HTML5 has that.The ugly workaround is to put your upload form in an iFrame. Upload them one at a time; stash them in a temp folder of your creation. Using some sort of session mechanism on the server, you keep track of them. The final step is to let the user hit a confirm button, signifying that the complete transaction should be made permanent. When that happens, put the uploaded files in their permanent location. Your temp folder should now be empty. Next time the script runs, look for files in the temp folder that are older than, say, 6 hours. Remove them. Link to comment Share on other sites More sharing options...
OtagoHarbour Posted May 2, 2011 Author Share Posted May 2, 2011 Sorry, not yet. Fully implemented HTML5 has that.The ugly workaround is to put your upload form in an iFrame. Upload them one at a time; stash them in a temp folder of your creation. Using some sort of session mechanism on the server, you keep track of them. The final step is to let the user hit a confirm button, signifying that the complete transaction should be made permanent. When that happens, put the uploaded files in their permanent location. Your temp folder should now be empty. Next time the script runs, look for files in the temp folder that are older than, say, 6 hours. Remove them.Could I use ftp? Would it be advisable? I am using Windows XP.Thanks,Peter. Link to comment Share on other sites More sharing options...
OtagoHarbour Posted May 3, 2011 Author Share Posted May 3, 2011 Sorry, not yet. Fully implemented HTML5 has that.The ugly workaround is to put your upload form in an iFrame. Upload them one at a time; stash them in a temp folder of your creation. Using some sort of session mechanism on the server, you keep track of them. The final step is to let the user hit a confirm button, signifying that the complete transaction should be made permanent. When that happens, put the uploaded files in their permanent location. Your temp folder should now be empty. Next time the script runs, look for files in the temp folder that are older than, say, 6 hours. Remove them.Another alternative would be to get the user to upload a zip file. Would it be possible to write code to unzip the zip files automatically given that the zip files may come from a Windows, Linux, Unix, Mac, etc box?Thanks again,Peter. Link to comment Share on other sites More sharing options...
jeffman Posted May 3, 2011 Share Posted May 3, 2011 I don't know if platform would matter. PHP has a ZIP library extension. If you operate your own server, no problem. A lot of hosts you lease from won't have it installed. Link to comment Share on other sites More sharing options...
Synook Posted May 3, 2011 Share Posted May 3, 2011 There are also some Flash movies that will do what you want. Link to comment Share on other sites More sharing options...
OtagoHarbour Posted May 3, 2011 Author Share Posted May 3, 2011 There are also some Flash movies that will do what you want.Good point. Do you know if Flash and/or SilverLight run server-side?Thanks,Peter. Link to comment Share on other sites More sharing options...
OtagoHarbour Posted May 3, 2011 Author Share Posted May 3, 2011 I don't know if platform would matter. PHP has a ZIP library extension. If you operate your own server, no problem. A lot of hosts you lease from won't have it installed.I had a look at PHP Zip here http://www.w3schools.com/php/php_ref_zip.asp. It said to download and build ZZipLib and gave the link. I tried to build it under Win XP using MS Visual Studio, version 6 and it was a nightmare. I had to download a bunch of .h files and change the .c files' names to have the .cpp extension. Got me further but still wouldn't build. I've never had any luck with anything to do with zlib.Thanks,Peter. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.