hassank1 Posted March 19, 2008 Share Posted March 19, 2008 hey I am working on a page with a file upload form..and I know that the file info will be stored in $_FILES so let's say 2 users try to use the form to upload files at the same time..so what file will be saved into $_FILES .!!! one of them or both ! or what ?! thx.. Link to comment https://forums.phpfreaks.com/topic/96973-uploading-many-files-in-the-same-time/ Share on other sites More sharing options...
BlueSkyIS Posted March 19, 2008 Share Posted March 19, 2008 each user gets their own form, they don't use the same one at the same time. each will have their own version of $_FILES. Link to comment https://forums.phpfreaks.com/topic/96973-uploading-many-files-in-the-same-time/#findComment-496240 Share on other sites More sharing options...
hassank1 Posted March 19, 2008 Author Share Posted March 19, 2008 ok let's say I've allowed a user to upload 3 files at the same time (3 file input fields in form) and then I process the form and uploaded the files..then he enters the upload form again and upload 1 single file ...so does the new uploaded file replace the 1st file in $_FILES , and the old 2 files still in the array or does array unset it's values automatically after posting ?!! btw may I delete $_FILES[][] data using ( unset $_FILES ?) Link to comment https://forums.phpfreaks.com/topic/96973-uploading-many-files-in-the-same-time/#findComment-496356 Share on other sites More sharing options...
cooldude832 Posted March 19, 2008 Share Posted March 19, 2008 File uploads are handled via taking the raw data binaries and then transferring them to a temporary folder on your server with a temporary name given to it so that when multiple files hit your server at once they don't overwrite each other. The temp folder is purged every so often the the roving recycler on your server (usually 5-10 minutes) Generally the volume of file uploads/multiple users isn't an issue so long as you can process them on upload and not have them sit there. The $_FILES array is a php super global array containing pertinent data to the files uploaded in the Last set of POST data. If the previous page failed to send POST data $_FILES will be empty unless populated by some other source i.e cURL Link to comment https://forums.phpfreaks.com/topic/96973-uploading-many-files-in-the-same-time/#findComment-496360 Share on other sites More sharing options...
hassank1 Posted March 19, 2008 Author Share Posted March 19, 2008 ok well thanks (cooldude832 and BlueSkyIS ) I appreciate ur help Link to comment https://forums.phpfreaks.com/topic/96973-uploading-many-files-in-the-same-time/#findComment-496364 Share on other sites More sharing options...
PFMaBiSmAd Posted March 19, 2008 Share Posted March 19, 2008 FYI - the temporary file(s) for any submission is(are) deleted by php when that instance of the form processing page execution ends. Link to comment https://forums.phpfreaks.com/topic/96973-uploading-many-files-in-the-same-time/#findComment-496387 Share on other sites More sharing options...
hassank1 Posted March 19, 2008 Author Share Posted March 19, 2008 if I want to accept certain files (ex: jpg , bmp , zip etc...) , is there a way to store the allowed types in an array then check if the uploaded type is in array instead of typing ex: if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) || .... etc... Link to comment https://forums.phpfreaks.com/topic/96973-uploading-many-files-in-the-same-time/#findComment-496395 Share on other sites More sharing options...
PFMaBiSmAd Posted March 19, 2008 Share Posted March 19, 2008 I'll assume you did not see this function when you looked at the array functions in the php manual - http://php.net/in_array Link to comment https://forums.phpfreaks.com/topic/96973-uploading-many-files-in-the-same-time/#findComment-496398 Share on other sites More sharing options...
cooldude832 Posted March 19, 2008 Share Posted March 19, 2008 if u are doing images it is best to first try and open the image via getimagesize to verify its headers are valid over just a simple extension type Link to comment https://forums.phpfreaks.com/topic/96973-uploading-many-files-in-the-same-time/#findComment-496400 Share on other sites More sharing options...
hassank1 Posted March 19, 2008 Author Share Posted March 19, 2008 I was doing a simple test to figure out the mime type of (*.rar ) files ! so I've realized that it has the same mime type as an exe file !!! ok well what I want to do is to allow the upload of (jpg,bmp,doc,xls,pdf etc...) well simply !! everything except *.exe files ! any suggestions?! Link to comment https://forums.phpfreaks.com/topic/96973-uploading-many-files-in-the-same-time/#findComment-496414 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.