Fileupload : placeholders and replacement

Hazmat

New Member
Hi,
I am trying to use fileupload plugins with {BASE_contact_details___user_id} placeholder in the upload directory configuration. It only works if you do not use Ajax upload. With Ajax {BASE_contact_details___user_id} is not replaced by its value.
Is this a known problem?

JOOMLA 3.8.10
FABRIK 3.8.1
 
It's a documented feature. If you look at the tooltip on the upload directory setting:

Placeholders can be used, but note that if using the AJAX uploading option, you cannot use element placeholders, although other placeholders like '{$my->id}' will still work.

This is because the upload is done via AJAX when they select the file, at which point the element data is not available.

This is something I do plan to change at some point, so the AJAX upload is held in a temp folder until the form is actually submitted, then moved to the final directory. But at the moment, it is what it is.

-- hugh
 
Unfortunately there's not a lot I can do about that. Translations are a community effort.

So it's usually worth checking the wiki as well:

http://fabrikar.com/forums/index.php?wiki/file-upload-element/

Upload directory - the folder into which the uploaded files can be stored. Path to upload directory (eg images/stories/). Passed through replacement code, so images/stories/{$my->id} would be replaced with the current user's id. Other placeholders: {date} and {myql_date} will work, {tablename___element} will only work when not using ajax uploads.

-- hugh
 
So there is no (easy) way to upload to a folder with the username instead of the id when using ajax?
 
That should work fine. The $my syntax accepts any field name from the #__users table (well, any attribute from the JUser object for the logged in user, but same thing really), so {$my->username} should work just the same as {$my->id}. And with AJAX, "static" things like the $my replacement work fine, it's only dynamic form data using {table___element} which doesn't.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top