HTTP stops responding after FTP upload

D

dtfcalibrator

After executing the following code, all http requests to the server
don't work for ~1 minute. I have cpanel installed on another port, and
that stops responding as well. Any idea why this would happen?

use Net::FTP;
use File::Copy;

# example call:
# &sendFileToFTP('file.zip');
sub sendFileToFTP{
$fileToTransmit = $_[0];

$lower=10000;
$upper=99999;
$random = int(rand( $upper-$lower+1 ) ) + $lower;
copy("$fileToTransmit","$random\.zip") or die("Error copying: $!");

$ftp = Net::FTP->new("ftp.myupload.com, Debug => 0) or die $@;
$ftp->login("user,pass) or die $ftp->message;
$ftp->binary();
$ftp->put($random."\.zip") or die $ftp->message;
$ftp->quit;
unlink "$random\.zip";
};
 
D

DJ Stunks

<snip>
copy("$fileToTransmit","$random\.zip") or die("Error copying: $!");
<...>
$ftp->put($random."\.zip") or die $ftp->message;

I don't know about your port problem, but are you sure you want to
change the file name on the local system? why not just upload it as
the new file name:

$ftp->put($fileToTransmit,"$random.zip");

-jp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top