Is there any way to check file size before uploading it using JavaScript?
No Yes, using the File API in newer browsers. See TJ's answer for details.
If you need to support older browsers as well, you will have to use a Flash-based uploader like SWFUpload or Uploadify to do this.
The SWFUpload Features Demo shows how the file_size_limit
setting works.
Note that this (obviously) needs Flash, plus the way it works is a bit different from normal upload forms.