need help on php ftp client code
Posted: Tue Aug 25, 2009 10:47 am
Hi,
I've written a code to download some folders/files via ftp. Whenever i run the code in the hosted server by writing the http://localhost/ftp.php it works fine. But whenever i try to download files/folder from another pc by writing http://10.10.30.34/ftp.php, i see that the download process starts on the server itself... what I want to mean is that, the required file is seen downloaded in the server pc itself, but i want to download it to another pc as i'm running it from another pc.
Please help...
here is my code in simplified form:
<?php
require ("connection.php");
set_time_limit(480);
$conn=ftp_connection();
function file_downloader($conn, $remote_file, $local_file)
{
if (ftp_get($conn, $local_file, $remote_file, FTP_ASCII))
{
echo "<br>Successfully written to $local_file";
}
else
{
echo "There was a problem with the file " . "<br>";
}
}
$local_file=config.bat;
$remote_file=/c/config.bat;
file_downloader($conn, $remote_file, $local_file);
?>
I've written a code to download some folders/files via ftp. Whenever i run the code in the hosted server by writing the http://localhost/ftp.php it works fine. But whenever i try to download files/folder from another pc by writing http://10.10.30.34/ftp.php, i see that the download process starts on the server itself... what I want to mean is that, the required file is seen downloaded in the server pc itself, but i want to download it to another pc as i'm running it from another pc.
Please help...
here is my code in simplified form:
<?php
require ("connection.php");
set_time_limit(480);
$conn=ftp_connection();
function file_downloader($conn, $remote_file, $local_file)
{
if (ftp_get($conn, $local_file, $remote_file, FTP_ASCII))
{
echo "<br>Successfully written to $local_file";
}
else
{
echo "There was a problem with the file " . "<br>";
}
}
$local_file=config.bat;
$remote_file=/c/config.bat;
file_downloader($conn, $remote_file, $local_file);
?>