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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:38:08+00:00 2026-05-21T06:38:08+00:00

Is it possible to upload a file to the FTP server using PHP script

  • 0

Is it possible to upload a file to the FTP server using PHP script while the same script is downloading the meant file from somewhere else? So at the time script is downloading it should upload the file in real-time.

  • 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-21T06:38:09+00:00Added an answer on May 21, 2026 at 6:38 am

    Easy as cake, in theory. First, see FTP function here: http://www.php.net/manual/en/function.ftp-fput.php. Then we use FOPEN wrappers ( http://www.php.net/manual/en/wrappers.php ) to open the file we want to read, and send it over.

    To modify the php.net example:

    <?php
    
    // open some file for reading
    $file = 'somefile.txt';
    $fp = fopen('ftp://user:pass@domain.com/' . $file, 'r');
    
    // set up basic connection
    $conn_id = ftp_connect($ftp_server);
    
    // login with username and password
    $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
    
    // try to upload $file
    if (ftp_fput($conn_id, $file, $fp, FTP_ASCII)) {
        echo "Successfully uploaded $file\n";
    } else {
        echo "There was a problem while uploading $file\n";
    }
    
    // close the connection and the file handler
    ftp_close($conn_id);
    fclose($fp);
    
    ?>
    

    Oh, and you might want non-blocking sometimes: http://www.php.net/manual/en/function.ftp-nb-fput.php

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

Sidebar

Related Questions

is possible to upload a file on apache server using commons-fileuploader jar file in
I took this basic upload file script from php.net and it is giving two
Possible Duplicate: upload a file to server without using a form? I'am able to
Is it possible to upload a file from a local machine to the same
Is it possible to upload a file to another server or pass a file
Is it possible to use CRON to upload a file via FTP? If yes
Is it possible to upload file in facebook fbml (not iframe) using Ajax ?
Is it possible to transfer a file from local machine to a remote server
I'm writing a script that can FTP files and folders using PHP functionality. I'm
Is it possible to upload a file in OpenRasta using the PUT post method?

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.