Created
March 9, 2012 07:05
-
-
Save Chris927/2005412 to your computer and use it in GitHub Desktop.
HTML5 / pure javascript to post the 'modified date' when uploading a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>Just testing...</title> | |
| </head> | |
| <body> | |
| <script type="text/javascript"> | |
| function updateFile() { | |
| var files = document.getElementById("uploadInput").files; | |
| var nFiles = files.length; | |
| document.getElementById("for_hidden_fields").innerHTML = "<input type=\"hidden\" name=\"modified_at\" value=\"" | |
| + encodeURIComponent(files[0].lastModifiedDate) | |
| + "\" />"; | |
| }; | |
| </script> | |
| <form name="uploadForm" action="post_files" method="POST" enctype="multipart/form-data"> | |
| <div id="for_hidden_fields"></div> | |
| <input type="file" name="myFile" id="uploadInput" onchange="updateFile();" /> | |
| <input type="submit" /> | |
| </form> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment