Thomas Crawford
Thomas Crawford

Reputation: 896

jQuery File Uploader Plugin and Symfony 2

I want to use this plugin in my symfony 2 project:

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

I followed all the steps in the documentation. But it keeps saying that this path is not found :

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/ 

My code in the twig file :

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

my 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>

Upvotes: 1

Views: 2719

Answers (1)

Sander Toonen
Sander Toonen

Reputation: 3573

I don't think web/ should be part of your path (Unless http://localhost/vdvinfra/web/ is the base path of your application). Could you print the output of {{asset('js/file-uploader/server/php/')}}?

Also, when you want Symfony to handle your uploads, I recommend you take a look at the OneupUploaderBundle bundle. It has step by step instructions about how to set up Symfony with the jQuery File Uploader Plugin.

Upvotes: 1

Related Questions