Skip to content

Instantly share code, notes, and snippets.

@Palleas
Created January 12, 2010 08:03
Show Gist options
  • Save Palleas/274990 to your computer and use it in GitHub Desktop.
Save Palleas/274990 to your computer and use it in GitHub Desktop.
Testing the file HTML 5 API
<!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