Jump to content

Display list of files in a ftp directory


biwerw

Recommended Posts

PHP have ftp tools you can use to download, resize the thumbnails (gd) and save them local. It always depend on how many images you have but i'm not sure you can do this without being kicked by the timeout or the user will close the window thinking your site doesn't work or the browser may display a timeout even if your script work and you increase the time limit.

 

http://www.php.net/manual/en/book.ftp.php

http://www.php.net/manual/en/ref.image.php

 

You can also created a cron job that run each x hours and connect to the ftp, download the file, makes thumbnails and make a 'static' html file. Some sort of a html mirror of a ftp.

<?php

// set up basic connection

$conn_id = ftp_connect('ftp.example.com');

 

// login with username and password

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

 

// get contents of the current directory

$contents = ftp_nlist($conn_id, "."); // replace dot with your dir

 

// output $contents

print_r($contents);

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.