I have a simple website on which I want to display the modification date of a specific file in a text element on the websites body. Below is some code I have but it's meant for multiple files. I am pretty new to this so I cant seem to figure out how to get the attributes of one specific file on the server.
<script type="text/javascript" charset="utf-8">
if (window.File && window.FileList && window.FileReader)
{
/************************************
* All the File APIs are supported. *
* Entire code goes here. *
************************************/
function listFileProperties(event)
{
/* Read the list of the selected files. */
var files = event.target.files;
/* Read each file and list down the properties in a table. */
var output = "<table><tr><td>Filename</td><td>File Type</td><td>File Size</td><td>Last Modified Date</td></tr>";
for (var i = 0, f; f = files[i]; i++)
{
output += "<tr><td>" + escape(f.name) + "</td>"; /* f.name - Filename */
output += "<td>" + f.type + "</td>"; /* f.type - File Type */
output += "<td>" + f.size + " bytes</td>"; /* f.size - File Size */
output += "<td>" + f.lastModifiedDate + "</td></tr>"; /* f.lastModifiedDate - Last Modified Date */
}
output += "</table>";
document.getElementById('list').innerHTML = output;
alert(output);
}
}
else
{
alert('Sorry! your browser does not support HTML5 File APIs. Therefor the files date cannot be displayed');
}
</script>
Some help would be greatly appreciated! Thanks a lot!