I have a PHP (version 5) site on a Windows server that allows uploading of files into our Windows server. I currently allow the user to upload up to 10 files at once. If users upload files as big as 20 mb or more slows the upload process down. Should I just allow one file upload at a time for better performance? I was wondering how other PHP developers handle this?

This is one of the weaknesses of php. You can not use php to check the file size until AFTER the file/image has been SUCCESSFULLY uploaded to the server.

You also can not use javascript to access the client side file system. This is an area where i see Adobe Flash upload scripts really fill the gap. As they tend to be able to check the size of the file prior to the upload occurring.

I'd suggest looking into some of the many flash upload scripts that exist and how to tie them into php, unless someone else has a more controlled solution.

I first display a message to the user letting them know the maximum size of files they can upload (post_max_size), then I use a flash upload script to subtract from that number for each file they choose to upload. When they run out of space, I disable the browse files button.

I wish I still had the link for the flash script I am using. If I can track down the original source I will post it here.

are you uploading to a folder tricky question to answer you could try making a loop to upload one at time make the submit page call to itself until the files value return a false value then exit but this will still take the same amount of time i would of thought. That is how i handle my news letters when emailing them to alot of people

This article has been dead for over six months. Start a new discussion instead.