Click to See Complete Forum and Search --> : PHP and FTP
phani_mullapudi
05-20-2003, 06:28 AM
I want to upload a file using FTP in PHP, i did it, but i want upload file from where its stops in middle for some reason(ie., network fail, or other), can pls guide me,
This concept is used by file downloaders,
we can download when even we want it........
i need ur guidance in this .... ?
Weedpacket
05-20-2003, 07:13 AM
Without more detail it's almost impossible to make a useful diagnosis; is it possible that the script is timing out after the default thirty seconds? set_time_limit would help control that.
Bunkermaster
05-20-2003, 08:39 AM
he means FTP RESUME...
Mordecai
05-20-2003, 06:14 PM
Hmm, I'm not so sure how the FTP commands work in PHP, but I bet you'd have to find the filesize on the FTP server and then fseek() or use the FTP equivalent to offset the previous filesize in bytes.
I'll look it up on Google and post the results.
[Edit:]
Okay, it looks as though PHP comes with built in FTP_AUTORESUME, but it only works when you have FTP_AUTOSEEK enabled.
Additionally, under ftp_fput, as of PHP 4.3.0, you can add startpos, in bytes, as a position to start from.
Use the filesize of the previously uploaded file to get the starting position.
Sxooter
05-21-2003, 05:34 PM
I know how to do this from the client side, you use reget instead of get. From the delivery side there's a restart command. Can you get PHP to issue that? I've never used the built in stuff for it, so I'd probably just use the ftp command line client with backticks.
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.