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.

Link to comment
Share on other sites

<?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);

?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.