HTML
<div class="input-group"> <label class="input-group-addon">Image</label> <input class="form-control" type="file" name="image" id="image"/> </div>
JS
$(document).ready(function(){ $("#image").fileUpload({ url: "/upload.php", onSuccess: function(response){ //your code here }, onError: function(response){ //your code here }, before: function() { //your code here }, after: function() { //your code here }, responseType: "json", container: $(this).parent(), uploadOn: { selector: "#image", clientEvent: "change" } }); });
The reason why I made this was just because I wanted to define on what element and event would the image be uploaded