I have a website that allows users to upload video files but I want to limit the filesize to 2MB , this is pretty straightforward after uploading the file but does anyone knows if I can check the file-size before uploading it so I don't overload the server unnecessarily ?
I might be looking for a javascript/ajax solution but I don't have a clue on how to achieve this.
Any help will be very welcome. Thanks guys!
UPDATE:
I need to check the file size on client-side and NOT on server-side, is this possible ?
If you use php you can set php option - 'upload_max_filesize'. See http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize May be it helps.
You can read local files in JavaScript using
file reader
in HTML5:http://www.html5rocks.com/en/tutorials/file/dndfiles/