Solved

Display a file's last modified date on your webpage.

Posted on 2004-08-18
4
274 Views
Last Modified: 2013-12-16
There exists a file C:\whatever\file.txt

How would I obtain the last modified time and date for this file using JavaScript?
0
Comment
Question by:iemonslice
  • 2
4 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 100 total points
ID: 11830929
If the file exist on web server and your script is running in browser, then you have no chance accessing some files attributes.
0
 
LVL 19

Expert Comment

by:peh803
ID: 11830950
Right, you'd have to use the file system object in ASP or something like that..
0
 

Author Comment

by:iemonslice
ID: 11831120
K, can't do this using javascript.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 11831303
Thank you for trusting me.
Here is a workaround which works only if the file is below the web servers root directory and your server support the lastModified attribute and the browser can access that document attribute:

<html>
<body>
<iframe name="theFile" src="whatever/file.txt" width=0 height=0"></iframe>
<b>File: </b>whatever/file.txt<br>
<b>Date Modified: </b>
<script>
document.write(window.frames.theFile.document.lastModified)
</script>
</body>
</html>

Good luck,
Zvonko

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question