Dynamic Upload Directory not working

aaronpie

New Member
I am trying to get the upload directory for the fileupload plugin to work, but have had little success.

I have entered in my upload directory as follows:
/images/websites/{$my->id}/{fab_lwpictures___website}/{fab_lwpictures___category}/

When I go to the images folder the folder names are {fab_lwpictures___website} and {fab_lwpictures___category}. It is not replacing the placeholders with record information.
 
It's working if you have a fileupload element without ajax upload.

I don't know if placeholders pointing other elements are supposed to work with ajax fileupload.
 
Nope, unfortunately that won't work for AJAX uploading. This is a known issue. We'd need to rewrite our upload handling, to defer the move of the file from the temp upload folder to the target folder from happening during the AJAX upload phase, to during the form submit phase.

The problem being, the element values for the form are not submitted as part of the AJAX upload phase, as that's handled by plupload, not by us.

Unfortunately we didn't think about this when we coded that stuff up, and it's a fairly significant rewrite of the element's code.

Just to explain the gory details ... in a "normal" file upload, the upload happens during form submission, as part of the standard HTML form submission process, which dumps the file into whatever your web server uses for the tmp upload folder. Then our upload element handling moves it from that tmp folder, to the folder specified in the element settings, using the rest of the form's submitted data for any placeholder replacements.

In the AJAX upload, plupload handles pushing the file up via AJAX, by calling our custom upload method. In that handling, we move the file from the temp dir, to the element's folder. BUT ... plupload doesn't submit the rest of the form's data, so we can't do placeholder replacement.

What we need to do is split that handling up a bit, so we do the "safety" stuff (like making sure potentially dangerous things like PHP files are not left in the temp folder) during the AJAX phase, but defer moving from the temp dir to the element folder until the form is actually submitted, probably by saving some session data so we know what files have been uploaded.

-- hugh
 
Nope, unfortunately that won't work for AJAX uploading. This is a known issue. We'd need to rewrite our upload handling, to defer the move of the file from the temp upload folder to the target folder from happening during the AJAX upload phase, to during the form submit phase.

The problem being, the element values for the form are not submitted as part of the AJAX upload phase, as that's handled by plupload, not by us.

Unfortunately we didn't think about this when we coded that stuff up, and it's a fairly significant rewrite of the element's code.

Just to explain the gory details ... in a "normal" file upload, the upload happens during form submission, as part of the standard HTML form submission process, which dumps the file into whatever your web server uses for the tmp upload folder. Then our upload element handling moves it from that tmp folder, to the folder specified in the element settings, using the rest of the form's submitted data for any placeholder replacements.

In the AJAX upload, plupload handles pushing the file up via AJAX, by calling our custom upload method. In that handling, we move the file from the temp dir, to the element's folder. BUT ... plupload doesn't submit the rest of the form's data, so we can't do placeholder replacement.

What we need to do is split that handling up a bit, so we do the "safety" stuff (like making sure potentially dangerous things like PHP files are not left in the temp folder) during the AJAX phase, but defer moving from the temp dir to the element folder until the form is actually submitted, probably by saving some session data so we know what files have been uploaded.

-- hugh
 
I understand. I hope it will be available in the future. It helps with being able to upload multiple files.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top