2

I'm trying to use the blueimp Jquery File Upload plugin for the project I'm currently working on. It suits my needs perfectly, with one problem: I need to be able to change the path of the uploads, based on a GET variable on the page that contains the plugin. Basically, I'm using it as an image manager for a collection of vehicles, and I want it to connect to a separate folder for each vehicle.

I've been looking through the documentation and googling, and I've found the way to change the default directory (by modifying upload.class.php) but since I need this to be dynamic, that doesn't work.

I figure there has to be a way to add a POST variable to the ajax calls which activate the php scripts, but I can't even find out where those ajax calls are. I can't even find a reference to either of the php files (index.php and upload.class.php) throughout the code.

Any ideas on how to accomplish this?

1
  • Can you share the steps you made to achieve this? I am having the same problem...Thanks in advance Commented Oct 16, 2013 at 20:44

1 Answer 1

5

In your form, add a field like this:

<input type="hidden" name="path" value="<?echo $_GET['path'];?>">

And in your PHP where the file is uploading, just extract the path with:

$path = $_POST['path'];

Just put the path where it is specified in the PHP script.

Sign up to request clarification or add additional context in comments.

3 Comments

Ok, I've gotten most of it to work. I had to add the input like you said, and I also had to pass the variable in one of the functions .getJSON calls using the data parameter. It displays the folder contents, and uploads correctly, but the delete functionality doesn't work. Apparently this is a problem with custom folders, so I'm going to look into it some more.
Turns out the DELETE function doesn't get either the POST or GET arguements that I was sending, so I'm going to have to setup another variable to receive it. In any case, got it working!
Cool, don't forget to approve the answer if it helped you! :)

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.