PHP Classes

FTP Continue?

Recommend this page to a friend!

      PHP FTP  >  All threads  >  FTP Continue?  >  (Un) Subscribe thread alerts  
Subject:FTP Continue?
Summary:Inquiry about the continue function
Messages:2
Author:Chris Desautels
Date:2006-06-19 15:32:29
Update:2006-06-19 20:01:41
 

  1. FTP Continue?   Reply   Report abuse  
Picture of Chris Desautels Chris Desautels - 2006-06-19 15:32:29
Interesting class. I noticed the funtcion "function ftp_nb_continue($ftp)" in the API list, for "continuing retreiving/sending files". Does this mean that your class can upload a file in segments? Upload a chunk, log out, log back in, and upload the rest? Like many full fledged FTP programs.

If so, this would be the first time I've seen a solution to the problem of upload limits and script timeouts. Kind of a holy grail of sorts for the PHP community. These hardcoded limits have always stood in the way of my building a photo archive application in PHP. These archives often require the handling of very large files. I can easily envision files of up to 50 or 60 MB in size and on rare occasions, maybe even 150 to 200 MB. I don't have much experience with FTP in PHP, but I believe the file size upload limit is not relevant. This hardcoded limit is only relevant with HTTP uploads which uses a temp space. Isn't this correct? Doesn't FTP write directly to the disk during the course of the upload?

Even so, it's all moot because uploads like this would probably always run headlong into the script timeout limit. Which is why I've never bothered exploring PHP FTP a great deal.

I've always been on the lookout for a means to upload file in multiple sessions. Quit a session before the file size or script timeout is reached. Then immediately start another session and continue uploading the file starting where the previous session left off. Doing this as many times as necessary in order to upload the file. Can your class accomplish this? If so, how?

One would have to keep track of elapsed time and the amount of transferred data and before either reaches it's limit, kill the connection, re-execute the script and pick up the upload where it left off.

There would have to be some pretty robust error detection as well. And endless loop here would be pretty disasterous.

  2. Re: FTP Continue?   Reply   Report abuse  
Picture of Erwin Kooi Erwin Kooi - 2006-06-19 20:01:41 - In reply to message 1 from Chris Desautels
Chris,

This nb_continue method is just part of the complete proxy implementation I copied from the original FTP API that PHP supports.
Check this url.
http://nl3.php.net/manual/en/function.ftp-nb-continue.php

As you can see, I marked this method 'todo' because I'm not sure how to start a async thread in the background of the script, which handles the non-blocking upload/download.

As far as your intention to upload huge files, that's not what this class is intended for. HTTP upload has nothing to do with FTP. I guess to only way you can accomplish your goal, is to use a client java applet of activeX plugin, which fires parts of the huge file with a certain pause to the receiving server script.

Greets,
Erwin