3

I would like to simply list some files from my web server and display the file names on the front-end of my website.

I use Sourcerer plugin and created a custom module where I inserted this code to retrieve the files(it's not working, just loads empty):

<?php 

$path = 'home/mysite/public_html/tmp/containers/waybills/';

$array = array_map('basename', glob($path . '*.pdf')); 

?>
3

You can utilise Joomla's JFolder class like so:

<?php
    $array = JFolder::files(JPATH_SITE . '/tmp/containers/waybills');
?>

You'll then of course need to write a foreach loop, to loop through the array and echo the values.

Have a look at the JFolder::files API which will give you more information on additional function arguments, should you wish to use them

Hope this helps

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.