I wrote a quick script to upload files using LWP :: Simple library and its getstore () function. It works pretty well, but sometimes the downloaded file is not complete. I do not know what this causes, but when I load it manually, wget in the command line file is fine.
I would suggest that the damaged files are caused by a connection being deleted or something similar, although I run my script on a dedicated line in a data center connection, somewhere between my server and the remote server, a crash may occur.
This is my code:
sub download {
my $status = getstore($_[0], $_[1]);
if (is_success($status)) { return 1; } else { return 0; }
}
What are the possible solutions to this problem? How to check if the transfer has passed, and if the file is completed and not damaged?
Thanks for your valuable answers.