Resume abandoned downloads with php ftp?


Resume abandoned downloads with php ftp?



Is there any way to resume a broken download via an ftp connction established with php? Can php resume a broken download?




Is there an OO Perl equivalent to an interface?

1:



How do I get the class name or filename of the object that instianiated the current object?
Yes, it can, using the optional $resumepos parameter of the ftp_fget() function..
Strange problem with classes
Example:.
Access class static function via variable
$remote_file_name = "/test.txt"; $local_file_name = "test.txt"; $ftp_server = "ftp.your.server"; $username = "anonymous"; $password = "my@email";  $ftp_stream = ftp_connect($ftp_server); $result = ftp_login($ftp_stream, $username, $password); if ((!$ftp_stream) || (!$result)) {   echo "FTP connection failed\n"; } else {   echo "connected to FTP\n"; }  if (file_exists($local_file_name)) {   $resume_pos = filesize($local_file_name); } else {   $resume_pos = 0; }  $local_file_handle = fopen($local_file_name, "w"); $result = ftp_fget($ftp_stream, $local_file_handle, $remote_file_name, FTP_BINARY, $resumepos);  fclose($local_file_handle); ftp_close($ftp_stream); 
You could use the ftp_size() function to see if a file needs to be resumed or not, but it is not supported on all FTP servers so you'd have to check for that..
Java Program Structure Advice


Would you implement a strategy pattern here and if yes, how?


84 out of 100 based on 54 user ratings 354 reviews