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 7877581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:24:49+00:00 2026-06-03T03:24:49+00:00

I am adding an FTP upload to my site and keep getting this error

  • 0

I am adding an FTP upload to my site and keep getting this error when testing it live. The script works fully on my localhost.

What could be stopping it on my web host’s server?

Warning: ftp_login() expects parameter 1 to be resource, boolean given
in /home/content/20/8630520/html/filedrop.php on line 134

    <div id="form">
    <?

    if(!isset($_POST["submit"])){?>

    <form action="filedrop.php" method="POST" enctype="multipart/form-data">
    <fieldset>
        <label><span class="error">*</span> Server:</label> 
        <input size="50" type="text" name="server" value=""/>

        <label><span class="error">*</span> Username:</label> 
        <input size="50" type="text" name="user"  value=""/>

        <label><span class="error">*</span> Password:</label> 
        <input size="50" type="password" name="password" value=""/>

        <label><span class="error">*</span> Select File:</label> 
        <input name="userfile" type="file" size="50" style="height:23px;"/>

        <input type="submit" name="submit" value="Upload" />
    </fieldset>
    </form>
    <?}
    else 
    {

    set_time_limit(300);//for uploading big files

    $paths=$_POST['pathserver'];

    $filep=$_FILES['userfile']['tmp_name'];

    $ftp_server=$_POST['server'];

    $ftp_user_name=$_POST['user'];

    $ftp_user_pass=$_POST['password'];

    $name=$_FILES['userfile']['name'];



    // set up a connection to ftp server
    $conn_id = ftp_connect($ftp_server);

    // login with username and password
    $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

    // check connection and login result
    if ((!$conn_id) || (!$login_result)) {
    echo "1.) FTP connection has encountered an error!</br>";
    echo "2.) Attempted to connect to $ftp_server for user $ftp_user_name....</br>";
    echo "Go <a href=\"filedrop.php\">back</a> and try again.";
    exit;
    } else {
    echo "1.) Connected to $ftp_server, for user $ftp_user_name".".....</br>";
    }

    // upload the file to the path specified
    $upload = ftp_put($conn_id, $paths.'/'.$name, $filep, FTP_BINARY);

    // check the upload status
    if (!$upload) {
    echo "2.) FTP upload has encountered an error!</br>";
    echo "Go <a href=\"filedrop.php\">back</a> and try again.";
    } else {
    echo "2.) Uploaded file with name $name to $ftp_server ";
    echo "Go <a href=\"filedrop.php\">back</a> to upload more.";

    }

    // close the FTP connection
    ftp_close($conn_id);    

    }
    ?>
</div>

Do I need to modify this? Or add another file? I’m not exactly PHP advanced.

Thank you,

Seth

  • 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-06-03T03:24:51+00:00Added an answer on June 3, 2026 at 3:24 am

    It means your call to ftp_connect() failed and you don’t have a valid resource ID being passed to ftp_login() (in fact you’re passing false which is a boolean value). You need to figure out why your ftp_connect() is failing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to deploy a website asap and then incrementally keep on adding some
Adding UITableView Delegate to my ViewController Causing an Incomplete Implementation Error #import <UIKit/UIKit.h> @interface
Adding a comment such as this: // TODO: Refactor this code ...creates a task
adding the words AND, OR, NOT to a search query raises an error like
how do i go about adding ftp users to an apache web server? i
We have a process that is getting data in real time and adding records
Adding a service reference to a web service (this is all WCF) in Visual
Adding more than one child to a WPF StatusBar results in poor layout with
Adding Exceptional Handling is a good practise, but I have a doubt, In our
Adding the row one by one in the button click.. (i tried but its

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.