devio
devio

Reputation: 1169

Symfony2 & Blueimp/jQueryFileUpload : How to implement the Default uploader?

I want to implement the Blueimp/jQueryFileUploader in Symfony 2.2. I found a bundle but it doesn't actually work on Symfony2 (not supported yet according to the creator).

Anyway, I want to use in my application the Default version of that uploader. I added the files to the bundles folder of /web, and I can see the page that contains the buttons in Bootstrap. But when it comes to Javascript, it just throws this exception :

Unexpected character ";" in SitePersoBundle:Default:file_upload.html.twig at line 77 500 Internal Server Error - Twig_Error_Syntax

the line 77 contains :

{% for (var i=0, file; file=o.files[i]; i++) { %}

All I did is copy/paste the source code of the demo so I can test, but it throws the exception above. Why is that ?

Here's the link to the jQuery uploader on Github : https://github.com/blueimp/jQuery-File-Upload

Upvotes: 0

Views: 928

Answers (2)

Richard Green
Richard Green

Reputation: 61

Using the twig verbatim tag removed the errors for me, but I still had trouble getting the plugin to work.

The solution was to change the template engine, as per the documentation.

Upvotes: 0

dbrumann
dbrumann

Reputation: 17166

You have to mark the template as verbatim to rpevnt Twig from trying to interpret it:

{% verbatim %}
    The template
{% endverbatim %}

Upvotes: 1

Related Questions