Changing Joomla 3's media manager base path dynamically

Elena: 2 weeks ago

Does anyone know how to change Joomla's media manger base bath dynamically?

Or conversely if I specify a folder with the URL, can I set that to be the base path and stop users going further up in the directory?

For example, images is the base and I set the folder as apples in the URL. This displays the images/apples folder, can I stop users going back to images? Because the folder apples will be declared dynamically from within my component?


Asher: 2 weeks ago

The COM_MEDIA_BASE and COM_MEDIA_BASEURL constants are both defined in:


On line 42 and 43.

I suppose you could redefined them:

However, please be very careful with this if used! Constants are not supposed to be redefined, hence the name. If you do go down this road, it must be redefined back to its original value at the bottom of your function