Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6155047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:22:07+00:00 2026-05-23T20:22:07+00:00

I am trying to develop a web bassed FTP client for my NAS. When

  • 0

I am trying to develop a web bassed FTP client for my NAS. When I try to get a list of all the files on my NAS the script will just load forever. If I try to connect to my webhost through PHP instead, everything is fine and I can get a list of all the files.
If I run the script through the Terminal in Mac OS there is no problem getting a list of the files on my NAS.

Can anyone tell me why I cannot retrieve a list of the files on my NAS? Does it matter that I connect to my IP address (of course not the local IP :-)) and my port is not the default 21 but 2121?

Below is my script.

// Set IP and port
define("FTP_CONNECT_IP", "");
define("FTP_CONNECT_PORT", "");

// Set username and password
define("FTP_LOGIN_USER", "");
define("FTP_LOGIN_PASS", "");

// Set directory to open
$dir = ($_GET['dir']) ? $_GET['dir'] : ".";

// Connect to FTP server
$conn = ftp_connect(FTP_CONNECT_IP, FTP_CONNECT_PORT); // Timeout is not set, default is 90 seconds

// Log into FTP srever
$login_result = ftp_login($conn, FTP_LOGIN_USER, FTP_LOGIN_PASS);

// Print details about directory
// Set what directory name to show
$dir_name = ($dir == ".") ? "/" : "/" . $dir;

echo "Current dir: " . $dir_name . "<br /><br />";

foreach (ftp_nlist($conn, $dir) as $element) {
    $element_name = str_replace($dir . "/", "", $element);

    // Check if element is a file or a directory
    // If size is -1 then the element is a directory
    if(ftp_size($conn, $element) == -1) {
        echo "<a href=\"index.php?dir=" . $element . "\">" . $element_name . "</a><br />";
    }
    else {
        echo "<a href=\"http://" . $element . "\" target=\"_blank\">" . $element_name . "</a><br />";
    }
}

// Close connection
ftp_close($conn);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:22:07+00:00Added an answer on May 23, 2026 at 8:22 pm

    Perhaps your nas has a firewall. Try enabling passive mode by using:

    ftp_pasv($conn, true);
    

    after the

    ftp_login(...)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get some ideas about how to develop a web login screen.
trying to develop web form using jquery. all i need is to have several
I am trying to develop a web application that will do the following: Collect
I'm currently trying to develop a method to get a overview of all my
I'm trying to develop a standalone Java web service client with JAX-WS (Metro) that
I am trying to develop a web page that will allow user to edit
I'm trying to develop a script (in php) that anlayzes web pages and wondering
I am trying to develop web parts in VS 2008/WinXP I created a Web
I'm trying to develop a web application that dispatch (Dispatcher) to multiple versions of
I'm trying to develop a web application that is going to be launched from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.