Created
January 12, 2010 08:03
-
-
Save Palleas/274990 to your computer and use it in GitHub Desktop.
Testing the file HTML 5 API
This file contains 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 lang="en"> | |
<head> | |
<title>File API simple test</title> | |
<meta charset="utf-8" /> | |
</head> | |
<body> | |
<h1>Having fun w/ HTML 5 File API</h1> | |
<input type="file" multiple="true" id="chooser" /> | |
<script type="text/javascript"> | |
function $(id) | |
{ | |
return document.getElementById(id); | |
} | |
function fileChangedHandler() | |
{ | |
var fileList = $("chooser").files; | |
var length = fileList.length; | |
var currentFile; | |
for (var indexFile = 0; indexFile < length; indexFile++) | |
{ | |
currentFile = fileList.item(indexFile); | |
console.info(currentFile); | |
} | |
} | |
window.onload = function() | |
{ | |
$("chooser").onchange = fileChangedHandler; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment