0

Hi all,

I'm using @copy to copy large files from one server to another and it usually works fine.

Occasionally it stops mid way through though and I have to start again. So I wondered if anyone knows of a way php can read my half copied file, compare it to the original and continue copying the remaining data adding it to the file so it's exactly like the original?

The files being copied are usually zips but some are video and autio files.

Many Thanks!

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by webwiz
0

If you can read the half copied file, get it's size and append to it, then yes, it should be possible, but not with copy. You'd need to use fseek/fread/fwrite.

Edited by pritaeas: n/a

0

If you can read the half copied file, get it's size and append to it, then yes, it should be possible, but not with copy. You'd need to use fseek/fread/fwrite.

Thanks

I'm figuring I'll be able to read the half copied local file. It's copying the the missing half from the remote server and appending it into the local file that might be more difficult (for me).

From what I can tell I need to check if the socket connection was broken (stream_set_timeout maybe), if it was find the last point of the local file, re-establish the connection to the remote server file, seek the point it stopped at and append it to the local file. I gather with the fseek/fread/fwrite you mentioned.

I'll keep looking. Thanks again.

Edited by webwiz: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.