You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#114121 Path of media field (custom fields)

Posted in ‘Suggestions & Feature Requests’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Ryan on Thursday, 06 July 2023 13:06 BST

smartweb
Hi

I really like your custom field (media field) to extend the fields of the articles.

For a new project, we would like to allow images to be uploaded only to the folder that is named with the ID of the article (for example, images/news/1234 if the id of the article is 1234). However, in the current version of the plugin it is only possible to specify a path (images/news/), but not the ID.

Is there a possibility to extend the field with a parameter so that the above can be implemented? That would be a really useful feature.

Regards
Stef

Ryan
The article id is only available once an article has been created (ie: saved). This means that if you attempted to upload an image using a path that contained the id, before the article was saved, then it would be uploaded to a different folder, eg: images/news/0 than the one intended for the article.

For this reason, dynamic variables like id are not available for the File Directory Path.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

smartweb
Thanks for the quick reply, Ryan.

I can understand your reasoning, somehow it seems to work though. Tassos has such a solution on offer (https://www.tassos.gr/joomla-extensions/advanced-custom-fields/docs/how-to-add-a-file-upload-field-in-joomla-forms#settings). I just tested it, it works as desired. Maybe the extension can serve as an inspiration, how this feature could be implemented in your custom field.

Ryan
I'll look into it. It does look feasible, with the caveat I highlighted above.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.