我想通过php使用ftp细节上传PHP文件,如下所述。通过php使用ftp细节上传php文件正在执行php,而不是上传原始php文件
// 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!" ;
这里的问题是,这些文件包含PHP代码,应该有远程服务器上,但得到执行PHP,什么我得到的远程服务器上仅仅是HTML。
请帮忙!
你能澄清一下问题所在吗?如果你上传'.php'文件,那是故意的,不是吗?你想知道什么 - 如何防止PHP文件被执行,或者如何在上传之前重命名文件? – 2012-02-20 12:05:22
说我正在上传一个文件test.php,它有这个代码<?php if($ _ GET ['id'] == 5){echo“Working”; }?>所以,这里想要的是,我需要在文件中具有相同的PHP代码。当我通过get方法传递id时,它应该可以工作。 只是添加我在我的网站上有一个文件,我上传到其他远程服务器。 – Prashant 2012-02-21 04:24:37