I am trying to implement the blue imp jquery file upload plugin from: https://github.com/blueimp/jQuery-File-Upload/ as often stated already the documentation is very detailed, but for me as beginner to jquery not really understandable.
I think I have basically lets say almost zero experience with jquery, so if anyone could help me out or give me a him I would be very glad!
I have tried to set up the basic implementation as it is in the wiki and saved following as index.html:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>jQuery File Upload Example</title>
</head>
<body>
<input id="fileupload" type="file" name="files[]" multiple>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="js/vendor/jquery.ui.widget.js"></script>
<script src="js/jquery.iframe-transport.js"></script>
<script src="js/jquery.fileupload.js"></script>
<script>
$(function () {
$('#fileupload').fileupload({
dataType: 'json',
url: 'server/php/',
done: function (e, data) {
$.each(data.result, function (index, file) {
$('<p/>').text(file.name).appendTo(document.body);
});
}
});
});
</script>
</body>
</html>
What I wanted to do is show the images that have been uploaded on the same page. I thought I need to do this in the callback when upload is finished. However, I have no idea where to put the code...
So, to find out where to put any code I simply tried to just get an alert-box and added this code | UPDATE: this works now:
$('#fileupload').bind('fileuploaddone', function (e, data) {alert("Message","Titel")});
I also tried to use simply (UPDATE: still does not work):
$('#fileupload').fileupload('disable');
as it is said in the wiki, but with no effect.
Am I using the code in the wrong place? The code itself should be OK I guess...
Thank in advance for any hint!