Last active
April 20, 2017 14:54
-
-
Save shrimpwagon/5363cf917970cea88bb4fd45da9761d1 to your computer and use it in GitHub Desktop.
HTML5 Image Uploader Example HTML/PHP
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
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> | |
<script src="html5-image-uploader.jquery.js"></script> | |
<script> | |
$(document).ready(function() { | |
$('#file').postFile({ | |
url: 'http://example.com/upload', | |
data: { | |
uniqid: '<?php echo $uniqid ?>' | |
}, | |
onProgress: function($elem, file, xhr, file_id, position, total, percentage) { | |
console.log(file.name + ': ' + position + ' of ' + total + ' ' + percentage + '%'); | |
}, | |
onSuccess: function(data, $elem, file, xhr, file_id) { | |
console.log(file.name + ' uploaded!'); | |
} | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
Upload file: <input type="file" id="file" multiple> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment