Hi
Is there ever a way possible to get the
actual creation / modification time of the file being uploaded, using JavaScript / PHP?
As for JavaScript, I have researched a lot, tried quite a few codes, but to no luck (perhaps trying to do possible out of impossible).
As for PHP, using
filectime() and
filemtime(), it only shows the date / time the file is uploaded, and not the time the file is actually created / modified on the source.
In short, what I want is to check the m-time of a file before/during/after upload (where-ever possible) and decide whether or not to store the file on the server, and report the same back to the client.
In case you need, here is a snap of HTML/JavaScript code that I fiddled with....
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Experiments</title>
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
<script type="text/javascript">
function _do(){
return true;
}
function getLastMod(){
var myFrm = document.getElementById('myIframe');
var lastModif = new Date(myFrm.contentWindow.document.lastModified);
return lastModif.toLocaleString();
}
function ShowTempImage(imagePath){
$("#test").html("<b>Before</b> " + getLastMod());
$("iframe#myIframe").attr("src",imagePath);
$("#test").html($("#test").html());
$("#LastModified").html("<b>Before</b> " + getLastMod());
}
</script>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data" onsubmit="return _do()">
<input type="text" id="txtTest" name="Text" />
<input type="hidden" id="hidTest" name="Hidden" value="Some value" />
<input type="file" id="uplTest" name="File" onchange='ShowTempImage(this.value);' />
<input type="submit" value="Submit" />
</form>
Test Value: <span id="test"></span>
<br />
Last Modified Date : <span id="LastModified"></span>
<iframe id="myIframe" onload="" src="C:\\xampp\htdocs\\experiments\\DSC03425.JPG" style="display:block; width: 800px; height: 400px;"></iframe>
<img src="file:///C:/xampp/htdocs/experiments/DSC03425.JPG" />
</body>
</html>
Any help please.......
Thanks in advance