Using FTP effectively

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PZAnders
Forum Newbie
Posts: 4
Joined: Wed Feb 04, 2009 7:40 am

Using FTP effectively

Post by PZAnders »

Hello,

This is my currenyt script for an FTP function (assuming $conn_id works and has previously been set):
foreach ($content as $file) {
$fo = fopen($fp, 'r');
if (ftp_fput($conn_id, $fp, $fo, FTP_ASCII)) {
echo "Uploading $fp now..<br>";
echo "Successfully uploaded $file<br>";
}
else {
echo "There was a problem while uploading $file\n";
die();
}
This all works fine, however obviously the page just hangs until the FTP upload is complete, leaving the end user guessing how long it will take or whether it will work at all.

So I am asking, is there a way start the FTP function in a different window/browser automatically.

Ideally, I would create a different batch script in the foreach loop pointing to files to be uploaded and FTP servers. I would then call this batch script using system or passthru? The theory seems right, but my lack of experience is causing the practise to suffer!!

Any help would be much appreciated!!
Many thanks in advance
Post Reply