PHP Upload File to FTP Asynchronously

Posted on 2006-03-22
Last Modified: 2013-11-30
Howdy people,
  I've done plenty of uploading files to FTP servers with PHP, but only from my web host to the FTP server.  Is it possible to send a file straight from the browser to the FTP server?  Or more likely, start sending a file to the FTP server, while it's still being upload to the web server from the browser?

  I did some reading on ftp_nb_fput, and it almost seems like it would be possible for PHP to open the temporary file as it's being uploaded to the web server, and start sending it to the FTP server before it's done downloading.

  I'm not against using some JavaScript if that's needed.

- Sean
Question by:headzoo

    Author Comment

    Oh yeah, I also don't care if I have to use some kind of cgi script to help out.
    LVL 15

    Accepted Solution

    Well, if you're talking about uploading a file to your web server and having your web server send it to an FTP while you are STILL uploading it, I'm not sure that's really possible.  Even if it were, your server's upload speed is probably MUCH higher than the internet connection you're using (most cable and DSL lines are capped for upload speeds).  This means that if your web server was able to send the file as it was receiving it, it would likely run out of data to send before you finished uploading.

    If you want to just open up an FTP connection in your web browser, just do this:

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    #Citrix #Citrix Netscaler #HTTP Compression #Load Balance
    Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now