I’m going to use the basic version of the Blueimp jQuery-File-Upload library for file upload.
In a PHP framework, this Javascript library relies on the execution of the PHP class “index.php” which is placed in “server/php” directory. As shown in the tutorial page, the “action” has to point to that directory.
When using this library in a Symfony2 application, where should “server/php” directory be placed? Which path should I use?
In practice how to let it works?
PS: I know there is some Symfony2 bundle like Punkave’s “symfony2-file-uploader-bundle”, but there is something in the tutorial I’m missing and I wish not to recurr to Symfony2 forms-
I would place the jquery plugin contents into
web/bundles/<your bundle name>/js/jquery-file-upload. And then I would configure the script (check Options config) to look for the index.php file at:/bundles/<your bundle name>/js/jquery-file-upload/server/php/index.php.Of course, you’ll have to modify that index.php file to check if the user is logged in and if he has the right permissions.
As an example, this is what I did in a test environment:
I added this action to the controller:
And I created this template: