/    Sign up×
Community /Pin to ProfileBookmark

Get Date file was Uploaded to Server

Hi,
I would like to create a script that behaves differently according to the date it was uploaded to the webserver. Meaning – if I send the script to my friends and each one uploads it to his server on a different date – each one will get a different behavior.

Something like:
[INDENT][COLOR=”DarkRed”][B]uploaddate=[I]getuploaddate()[/I];[/B]
if uploaddate between Jan 1…Jan15, 2010
do this1;
elseif uploaddate between Jan 16…Jan31, 2010
do this2;
elseif uploaddate between Feb 1…Feb 15, 2010
do this3;
etc.[/COLOR]
[/INDENT]
[B]My question: Which function can I use to get the upload date (instead of [I]getuploaddate()[/I] )[/B]

Thanks!

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@mrhooNov 04.2010 — The 'Last-Modified' date is the last time the file was saved on that server, and can be read in the header response. [/QUOTE]

[CODE]function fileModified(url){
try{
var O= new window.XMLHttpRequest();
O.open("HEAD", url, false);
O.send(null);
if(O.status== 200){
return O.getResponseHeader('Last-Modified');
}
else return null;
}
catch(er){
return null;
}
}[/CODE]

alert([B]fileModified(url)[/B])
Copy linkTweet thisAlerts:
@bradmcNov 06.2010 — Thanks. Just what I needed!
×

Success!

Help @ibelieve spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...