0

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

4
  • So.. does anybody have an idea ?? Commented Apr 27, 2013 at 13:22
  • Yes, why do you put for (var i=0, file; file=o.files[i]; i++) { inside blocks ( {% %} ) ? Commented Apr 27, 2013 at 17:14
  • I didn't, it's how the script is written. Check out the source code : blueimp.github.io/jQuery-File-Upload Commented Apr 27, 2013 at 17:35
  • Both use {% and %} as delimiters, that's the cause of your problem. Commented Apr 27, 2013 at 17:47

2 Answers 2

1

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

{% verbatim %}
    The template
{% endverbatim %}
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.