Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery-file-upload plugin : How to change the upload path?

I'm trying to work with the blueimp jquery-file-upload plugin. Seems to be a good uploader, but the documentation is not helpful.

When I work with the downloadable demo script, all is ok. But, when I want to change the upload path, that doesn't work.

I've tried to change, in index.php, the action path, like this :

form id="fileupload" action="../uploads/" method="POST" enctype="multipart/form-data"

and added the folders "files" and "thumbnails" in my "uploads" folder.

The GET call is ok, as I can see in Firebug :

GET http://localhost/alliance_pretests/uploads/ 200 OK -8ms

But when I launch the upload action, the POST answers me (still in Firebug) :

POST http://localhost/alliance_pretests/uploads/ 404 Not Found 44ms

I didn't change anything else. What did I forget ?

Why the GET call sees the folder, but not the POST call ?

Thanks in advance. Best regards.

like image 839
mlh Avatar asked Feb 22 '12 15:02

mlh


1 Answers

Although the answer @mugur supplied is correct, looking at the php class supplied with the library the first parameter in the construct method is "options" and by declaring an associative array as follows:

$options = array('upload_dir'=>'upload/directory/of/your/choice', 'upload_url'=>'upload/directory/of/your/choice');

and passing it as the first parameter when instantiating the class:

$upload_handler = new UploadHandler($options);

Will allow you to change the upload directory every time you use the class rather than altering the source code.

like image 187
Roark Avatar answered Sep 25 '22 07:09

Roark