Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • Last Modified:

PHP Upload File to FTP Asynchronously

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
1 Solution
headzooAuthor Commented:
Oh yeah, I also don't care if I have to use some kind of cgi script to help out.
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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now