I am trying to implement the blueimp jquery fileuploader. but there are so many options that I do not need.
All I am trying to accomplish is a simple upload form which saves the file (all files allowed) in a folder on my server.
I've followed this guide: https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin
And it works in the sense that I am able to send data to my PHP
file (which at the moment is empty).
In my network tab this is what is sent:
------WebKitFormBoundaryJAh0SYem6x65yoGw
Content-Disposition: form-data; name="files[]"; filename="199370898.pdf"
Content-Type: application/pdf
------WebKitFormBoundaryJAh0SYem6x65yoGw--
I can't find in the tutorials what to do after this. On their wiki there are only tutorials for frameworks like Zend/CakePHP
but I am not using a framework.
I'll probably can figure out how to get the filename using the form-data but where is the actual file itself?
I've made an upload script for images myself before which sent a base64 string, I don't see anything like that here.
My JS:
<script>
$(function () {
$('#fileupload').fileupload({
dataType: 'html',
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress .bar').css(
'width',
progress + '%'
);
},
done: function (e, data) {
$.each(data.result.files, function (index, file) {
$('<p/>').text(file.name).appendTo(document.body);
});
}
});
});
</script>
HTML:
<input id="fileupload" type="file" name="files[]" data-url="includes/uploadhandler.php">
<div id="progress">
<div class="bar" style="width: 0%;"></div>
</div>