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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:30:00+00:00 2026-05-22T16:30:00+00:00

When i try to upload files using PHP’s ftp_put function, earlier it was erroring:

  • 0

When i try to upload files using PHP’s ftp_put function, earlier it was erroring:

Warning: ftp_put() [function.ftp-put]: No data connection

Now, i tried to put passive mode on:

ftp_pasv($conn_id, true);

then comes error:

Warning: ftp_put() [function.ftp-put]: Type set to I. in

ftp_login is done properly and it says Successfully.

Now it gives new warning: Warning: ftp_put() [function.ftp-put]: abc.txt: Cannot open or remove a file containing a running program.

Any ideas, why file not tranferring ?

Thanks !

Here is my code snippet:

    $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");

    $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass) or die("You do not have access to this ftp server!");

    if ((!$conn_id) || (!$login_result)) {
        // wont ever hit this, b/c of the die call on ftp_login
        echo "<span style='color:#FF0000'><h2>FTP connection has failed! <br />";
        echo "Attempted to connect to $ftp_server for user $ftp_user_name</h2></span>";
        exit;
    } else {
        //echo "Connected to $ftp_server, for user $ftp_user_name <br />";
    }

    //turn passive mode on
    ftp_pasv($conn_id, true);

    $upload = ftp_put($conn_id, $destination_file.$name, $filename, FTP_BINARY);

    if (!$upload) {
        echo "<span style='color:#FF0000'><h2>FTP upload of $filename has failed!</h2></span> <br />";
    } else {
        echo 'Uploaded';    
    }

 ftp_close($conn_id);
  • 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-22T16:30:01+00:00Added an answer on May 22, 2026 at 4:30 pm

    The last error you are seeing happens when the FTP daemon is stuck with the uploaded file open and waiting for you to write to it.

    Anytime you successfully open a connection over an FTP server, be prepared to close the connection with the following function when the process completes or terminates due to any errors.

    ftp_close($conn_id);
    

    It’s possible your script is leaving its connections open and the FTP server is getting confused by this. Try adding ftp_close in the appropriate places and see if the script runs more smoothly.

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

Sidebar

Related Questions

I'm having trouble using PHP to SFTP upload files to a remote server. When
when i try to upload two files in the form, it doesn't happen!!! here
I am trying to upload something using PHP and set a limit on the
I have a problem with the filereference class using the upload function. I want
I'm trying to upload a file using PHP. My HTML page with the form
I am trying to upload files using Java URL class and I have found
I'm trying to upload some videos using PHP. But I can't get them into
So I'm using Codeigniter and I want to upload files. It's working fine except
I am using the Jquery Form plugging to try and upload a picture to
Using the uploadprogress plugin to show the Progress Bar during file upload and try

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.