Hi All,
I am trying to make some file transfers (ftp, http, upload) from server to server or client to server but I get PHP blocked while doing any of those transfers. I am running PHP 4.2.2 on RedHat 9.
PHP gets blocked only for the session doing the transfers. Is there anyway to not to get it blocked? Letting the user continue through the forms while the transfer is being done?
I have tried to find any tips on this everywhere with no luck. I am almost in need of a reboot of my brain. 😕
Any HELP will be very much appreciated!!!
FTP:
$conn_id = ftp_connect($ftp_server, $port);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if ((!$conn_id) || (!$login_result))
{
$ok=false;
exit;
}
else
{
if ($ftp_passive=="Y")
{
$mode= ftp_pasv($conn_id, true);
}
else
{
$mode= ftp_pasv($conn_id, false);
}
if(!isset($_GET["dir"]))
{
$ok=false;
exit;
}
else
{
if ([B][COLOR=red]ftp_get($conn_id, $local_dir . $file_name, $remote_dir.$file, FTP_BINARY)[/COLOR] [/B])
{
$ok=true;
}
else
{
$ok=false;
}
}
}
ftp_quit($conn_id);
HTTP:
$f=@fopen( "$download_path", "r");
if ($f)
{
$g=@fopen( "$local_dir/$file_name", "w");
if ($g)
{
while(!feof($f)) fwrite($g,fread($f,256),256) ;
fclose($g);
}
else
{
$ok = false;
}
fclose($f);
}
else
{
$ok = false;
}
UPLOAD:
move_uploaded_file($_FILES['upload_path']['tmp_name'], $target_path)
.