问题
I am using this bundle for a multi file upload in my symfony 2 project :
https://github.com/1up-lab/OneupUploaderBundle
in combination with this plugin :
http://blueimp.github.io/jQuery-File-Upload/
The upload itself is working but i also get this error in my console:
GET http://localhost/vdvinfra/web/app_dev.php/_uploader/gallery/upload 405 (Method Not Allowed)
665832b_jquery-2.0.3.min_1.js:6 x.support.cors.e.crossDomain.send665832b_jquery-2.0.3.min_1.js:6 x.extend.ajax7b52311_main_9.js:61 (anonymous function)665832b_jquery-2.0.3.min_1.js:4 l665832b_jquery-2.0.3.min_1.js:4 c.fireWith665832b_jquery-2.0.3.min_1.js:4 x.extend.ready665832b_jquery-2.0.3.min_1.js:4 S
Because of that the plugin is not working as it should be. (Not showing progress bars or messages).
The bundle says in its documentation that i need to make a route in my routing.yml like this:
oneup_uploader:
resource: .
type: uploader
config.yml :
oneup_uploader:
mappings:
gallery:
frontend: blueimp
my simple input field:
<input id="fileupload" type="file" name="files[]" data-url="{{ oneup_uploader_endpoint('gallery') }}" multiple />
my javascript:
$(document).ready(function () {
$(function () {
$('#fileupload').fileupload({
dataType: 'json',
done: function (e, data) {
$.each(data.result, function (index, file) {
$('<p/>').text(file.name).appendTo(document.body);
});
}
});
});
});
I already changed the route methods to post, put and get. Still not working.
I wonder if anyone can solve this problem!
Thanks
回答1:
What web server do you use? I suggest it is Nginx. You have to fix your config file.
来源:https://stackoverflow.com/questions/28536768/jquery-file-upload-blue-imp-symfony-2-405-method-not-allowed