DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

File Upload Size Validation using Ajax.

By: | 24 Jul 2009 11:50 am

In My Web Form when the user upload the multiple files. The size of the Files should be validated. IS there any Scripts done by any one already..

Comments

<input type="hidden" name="MAX_FILE_SIZE" value="30000" />

The above is just HTML so the user can change it.

$_FILES[`userfile`][`size`]
Is provided by the browser so it can also be faked.

filesize($_FILES[`userfile`][`tmp_name`])
Will give the correct file size.

Please rember that directory listing are cached in PHP so it may be nessesary to flush the cache for a correct listing (including file sizes)

By: | 24 Jul 2009

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move