Finding attachment length through javascript

How can i restrict the attachment size(say 500KB) using file-upload control. Is there any way to do this using javascript.

Subject: Finding attachment length through javascript

JavaScript cannot access the file on the hard disc. Since the path to the file is the best you can get in JS, there’s no way to do it that way.

Taken browser plug-ins like signed activeX controls or Java applets aside (which might be able to do something like that), your only option is the WebQuerySave agent. To prevent the doc from being saved, set a SaveOptions field (which must be present on the form already!) to “0”.