I’m trying to upload PHP file via php using ftp details as mentioned below.
// retrieve name of the file to be uploaded
$source_file=$site_url."IMlobby/IMlobby".$_SESSION['zip_name']."/".$filename;
$fp = @fopen($source_file, 'r');
$destination_file=$filename;
//$upload = ftp_fput($conn_id, $destination_file, $fp, FTP_ASCII);
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_ASCII);
// check upload status
if(!$upload){
$errorMSG.="FTP upload has failed!" ;
Here the issue that these files contain PHP code that should be there on remote server but the PHP is getting executed and what I’m getting on the remote server is just HTML.
Please help!
If file is locally hosted, do not open file by its URL. Use its local path instead.
If you do not know what your local path is – use $_SERVER[“DOCUMENT_ROOT”] to find out.