jQuery文件上传(Blue imp)Symfony 2 405方法不允许

时间:2015-02-16 07:52:39

标签: php jquery symfony blueimp

我在symfony 2项目中使用此捆绑包进行多文件上传:

https://github.com/1up-lab/OneupUploaderBundle

与此插件结合使用:

http://blueimp.github.io/jQuery-File-Upload/

上传本身正在运行,但我也在控制台中收到此错误:

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

因为插件不能正常工作。 (不显示进度条或消息)。

该软件包在其文档中说我需要在我的routing.yml中创建一条路径,如下所示:

oneup_uploader:
    resource: .
    type: uploader

config.yml:

oneup_uploader:
mappings:
    gallery:
        frontend: blueimp

我的简单输入字段:

<input id="fileupload" type="file" name="files[]" data-url="{{ oneup_uploader_endpoint('gallery') }}" multiple />

我的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);
                    });
                }
            });
        });

    });

我已经将路线方法改为post,put和get。 还是行不通。

我想知道是否有人可以解决这个问题!

由于

1 个答案:

答案 0 :(得分:0)

您使用什么网络服务器?我建议它是Nginx。你必须修复你的配置文件。

相关问题