Created
March 27, 2013 18:06
-
-
Save cpatrick/5256635 to your computer and use it in GitHub Desktop.
Simple test for folder uploading.
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
<html> | |
<head> | |
<title>HTML5 Folder Upload Test</title> | |
</head> | |
<body> | |
<div id="container"> | |
<input type="file" id="file_input" name="file_input_folder[]" | |
multiple webkitdirectory="" mozdirectory="true" directory="" /> | |
</div> | |
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> | |
<script type="text/javascript"> | |
var printFiles = function (event) { | |
var files = event.currentTarget.files; | |
for (var indx in files) { | |
var curFile = files[indx]; | |
console.log(curFile.webkitRelativePath); | |
console.log(curFile.slice(0,curFile.size)); | |
} | |
console.log(files); | |
}; | |
$('#file_input').change(printFiles); | |
</script> | |
</body> | |
</html> |
Thanks. This helped me to upload recursive folders with relative path
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I made this to see if recursive upload was possible without a browser plugin. It's only possible on Chrome.