Possible Duplicate:
How can you determine the file size in JavaScript?
GMail has the option to check file size and alerting without letting the page posting back.
How can I implement this feature myself?
Possible Duplicate:
How can you determine the file size in JavaScript?
GMail has the option to check file size and alerting without letting the page posting back.
How can I implement this feature myself?
Using HTML5, you can achieve this on the client side using JavaScript. This is jQuery but it works without as well of course: http://jsfiddle.net/pimvdb/S4mEv/2/. Note that it's not available in all browsers (yet).
https://developer.mozilla.org/en/DOM/File
You can do that file HTML5 JS File API
You can test run the below codes in my web IDE (but please use google chrome or FF): http://codesocialist.com/#/?s=bN
The below codes retrieve the filetype and filesize for you :)
Gmail uses a Flash application for this purpose. If you want to check file sizes, you need to do this from within such an environment; JavaScript alone has no mechanism to accomplish this.
You can use Uploadify, it's a jQuery plugin that uses flash for checking file size and has other neat functions. http://www.uploadify.com/documentation/options/sizelimit/