Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-08-18
4
Medium Priority
?
290 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 400 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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
Suggested Courses

971 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