Hello all, my first post here, shame it has to be a cry for help.
I'm trying to get file uploads working on a new site I'm developing, and everything is fine except for uploading large files.
I've tried searching for help, but they all come at the problem from the other end, see I don't want the users to upload anything over 4meg.
I've put in MAX_FILE_SIZE at 4194304 in the form, then in the script which processes results I check the $_FILES['file']['error'] variable. If it's set to 1 or 2 I report a file size upload error.
Otherwise I try and move it out of the temporary folder and check the filesize() results and again report an error if due.
When I run the script, if I upload a large file in Firefox 3, it hangs for a few minutes then returns me the appropriate error file size error. However if I do the same in IE7 or 8 it hangs for a long time (a few minutes), then just gives me page cannot be displayed.
It's probably just a hole in my understanding. I presumed browsers would check the MAX_FILE_SIZE variable in the first instance and not even bother uploading the first 4 meg of a file only to tell the user it's too big?
I'm just completely flumoxed as to why I get a page cannot be displayed. It's like the script is timing out before it realises that say a 7meg file is larger than the 4meg limit. I can't believe though to limit an upload I need to increase execution time of a script. It seems completely counter intuitive to me.
Is there a way I can make this happen sooner without having to resort to an applet or something to check it client side?
We're running PHP 5.1.5 under IIS on Win NT, and as I say testing with FF3 and IE7/8.
I can provide code samples if it will help, but I strongly suspect someone will point out my stupid error before that point 😉
Thanks for any help you can offer,
Si