jQuery File Uploader Plugin and Symfony 2


jQuery File Uploader Plugin and Symfony 2

我想在我的symfony 2项目中使用这个插件:

https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin

我按照文档中的所有步骤进行操作。但它一直说找不到这条路径:

error:
Failed to load resource: the server responded with a status of 404 (Not Found)
path:
http://localhost/vdvinfra/web/js/file-uploader/server/php/ 

我在树枝文件中的代码:

  <input id="fileupload" type="file" name="files[]" data-url="{{asset('js/file-uploader/server/php/')}}" multiple>

我的 js :

<script type="text/javascript">
  $(function () {
    $('#fileupload').fileupload({
      /* ... */
      progressall: function (e, data) {
        var progress = parseInt(data.loaded / data.total * 100, 10);
        $('#progress .bar').css(
          'width',
          progress + '%'
        );
      }
    });
  });
</script>

我认为web/不应该成为您路径的一部分(除非http://localhost/vdvinfra/web/是您应用程序的基本路径)。你能打印{{asset('js/file-uploader/server/php/')}}的输出吗?

另外,当你希望Symfony处理你的上传时,我建议你看看OneupUploaderBundle捆绑包。它有关于如何使用jQuery文件上传器插件设置Symfony的分步说明。