Search code examples
phpfile-uploadjoomlapublic-html

Upload a file to public_html folder


I have a joomla component that fetches the audio songs from the music folder on the server and plays them in the front end. And the users can upload their songs from the front end.

But the problem is that, the component settings are such that the music folder path must be outside of the web root.

The path looks like:

/home/username/public_html/audio

But i am confused how to upload the files to a location inside 'public_html' folder, using php. What should be the destination address that i can use in my code?


Solution

  • To get the server path in the Joomla environment:

    echo JPATH_SITE;
    

    Examples of usage