hi i am stucked some where inthis work never did it before
i some how not getting some path right , i am getting the warning
regards,
Omer Aslam
i some how not getting some path right , i am getting the warning
Warning: ftp_fput() expects parameter 3 to be resource, string given in C:\xampp\htdocs \ews\projects\i mage-magick\imageMag ick\ftp-chk.php on line 91
Code:
class Ftp{
function ftpTransfer($ftpstream,$ftp_user,$ftp_pass,$ftp_new_file,$ftp_path){
//Login to the FTP server
$login = @ftp_login($ftpstream, $ftp_user, $ftp_pass);
if($login) {
//We are now connected to FTP server.
echo "switching to $ftp_path<br />";
if(!ftp_chdir($ftpstream,$ftp_path)){
echo "Could not switch to the remote directory<br />";
}
if(!chdir("C:/xampp/htdocs/ews/projects/image-magick/imageMagick/")){
echo "Could not switch to the local directory<br />";
}
//Create a temporary file
if($this->getFiles($ftp_new_file,$ftpstream)){
return true;
}else{
return false;
}
}else{
echo "Could not Login to the remote site";
}
}
function getFiles($ftp_new_file,$ftpstream){
$source_file = "INFO.txt";
//Upload the file to server
if(ftp_fput($ftpstream, $ftp_new_file, $source_file, FTP_ASCII)){
return true;
}else{
return false;
}
}
}
$myFtp=new Ftp();
/* START */
$server_name="omaraslam.com";
$ftp_user='';
$ftp_pass='';
$ftp_path="/public_html/examples/";
$ftp_new_file=$ftp_path."omer.txt";
//Open stream
$ftpstream = @ftp_connect($server_name);
//Transfer Files Via Ftp
$A=$myFtp->ftpTransfer($ftpstream,$ftp_user,$ftp_pass,$ftp_new_file,$ftp_path);
if($A){
echo "Success transferred!<br />";
}else{
echo "Failure!<br />";
}
//Close FTP connection
ftp_close($ftpstream);
echo "Operation Completed";
Omer Aslam
Comment