[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Best approach for creating a list of downloads on a website from the contents on our FTP

Hello experts :)

I manage our company website and im looking for information on the best approach to create a list of downloads in our "software section" of the website. This list should be populated from the contents of a folder on our FTP site.

Im not asking to be spoon fed, but a point in the right direction would certainly help.

Thanks guys!
0
chris84
Asked:
chris84
1 Solution
 
RoonaanCommented:
Do you want to give additional titles to the available files, or do you need just a listing of the files available?

In the second case you could use:

<?php
 
  $path = 'path_to_my_ftp_dir'; //$path = dirname(__FILE__).'/downloads/';
  $href = 'url_to_my_ftp_dir'; //$path = 'http://mywebsite.com/downloads/';

  if(!is_dir($path))  //Directory not found
     echo 'No downloads';
  elseif(false === ($d = opendir($path))) //Directory could not be opened for whatever reason
     echo 'No downloads';
  else
  {
      echo '<b>Available downloads</b><ul>';
      while(false !== ($f = readdir($d)))
      {
           if(is_file($path.'/'.$f))  //show only files
             echo '<li><a href="'.$href.'/'.htmlspecialchars($f).'">'.htmlspecialchars($f).'</a></li>';
      }
      echo '</ul>';
  }
?>

-r-
0
 
EricCommented:
if you are using a html interface for the files, take a look at:

<!--
      WebExplorer Lite
      Copyright © 2000-2004 GleamTech
      http://www.gleamtech.com
-->
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now