You are here: Reference > JavaScript > client-side > HTML DOM > properties > fileSize (document, img)
fileSize property (document, img)
Returns the size of the file.
The fileCreatedDate, fileModifiedDate, lastModified, fileUpdatedDate and fileSize properties provide information about a file in JavaScript.
These properties are only supported by Internet Explorer, except for the lastModified property that, which is also supported by Firefox, Opera, Google Chrome and Safari.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read-only.
Possible values:
Integer that represents the size of the file in bytes.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the fileSize property:
|
||||
<head> <script type="text/javascript"> function GetFileInfo () { var message = ""; if (document.fileCreatedDate) { message += "The document file was created at: <b>" + document.fileCreatedDate + "</b><br />"; } if (document.fileModifiedDate) { message += "The document file was last modified at: <b>" + document.fileModifiedDate + "</b><br />"; } if (document.lastModified) { message += "The document file was last modified at: <b>" + document.lastModified + "</b><br />"; } if (document.fileUpdatedDate) { message += "The document file was last updated at: <b>" + document.fileUpdatedDate + "</b><br />"; } if (document.fileSize) { message += "The size of the document file is: <b>" + document.fileSize + " bytes</b><br />"; } var info = document.getElementById ("info"); info.innerHTML = message; } </script> </head> <body onload="GetFileInfo ();"> <div id="info" style="width:500px; overflow:auto; background-color:#e0d0d0;"></div> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments