Input.size (Property)

Returns the size of the file to be uploaded when the Input object represents a file upload.

Availability:

DOM level - 1
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Property/method value type:String primitive
JavaScript syntax:-myInput.size

It may be important to limit the size of files being uploaded to the server.

It is very possible that vindictive users may use this as an opportunity to try and crash your server or deny its availability to other users by uploading massive files to it.

In addition, there may be limits you want to impose as a courtesy to the network managers who run the LANs and WANs where your users will be browsing. Allowing the user to upload unnecessarily large files will saturate their network as well as your server.

By testing this property, you can impose limits of acceptability on file uploads.

See also:FileUpload.size, Password.size, TextCell.size