0.1.0 • Published 8 years ago
simple-xhr-uploader v0.1.0
Simple XHR Uploader
Queued file upload plugin for jQuery.
Requirements
- jQuery (tested with 1.9.1)
- FormData and XMLHttpRequest on browser
Usage
<input type="file" name="photo" id="photo" data-url="upload.php" />
<div id="browse" data-multiple="1"></div>
<script type="text/javascript">
// Simple usage
$("#photo").uploader();
// Passing some options
$("#browse").uploader({
url: "upload.php",
multiple: false, // Overwrite "data-multiple" attribute
progress: function(loaded, total) {
var loadedInPercentage = Math.round(loaded * 100 / total);
console.log(loadedInPercentage + "%")
},
xhr: { // For each XHR on the queue
start: function() {
console.log("New progress has started");
}
}
});
</script>
Options
License
MIT
0.1.0
8 years ago