Detecting file upload size on the client side?

Posted by DisgruntledGoat on Stack Overflow See other posts from Stack Overflow or by DisgruntledGoat
Published on 2010-05-29T11:22:49Z Indexed on 2010/05/29 11:32 UTC
Read the original article Hit count: 163

Filed under:
|
|

I'm using PHP for file uploads. In the PHP manual it shows an example using a MAX_FILE_SIZE hidden field, saying that it will detect on the client side (i.e. the browser) whether the file is too large or not.

I've just tried the example in Firefox, Chrome and IE and it doesn't work. The file is always uploaded, even if it is way larger than the specified hidden field.

Incidentally, if the file is larger than MAX_FILE_SIZE then calling move_uploaded_file doesn't work, so it seems the variable is having an effect server-side, but not client-side.

© Stack Overflow or respective owner

Related posts about php

Related posts about html