Home  >  Article  >  Backend Development  >  通过php进行ftp文件下传时文件大小为0

通过php进行ftp文件下传时文件大小为0

WBOY
WBOYOriginal
2016-06-13 11:15:151167browse

通过php进行ftp文件上传时文件大小为0
$user=$_COOKIE['user'];
$passwd=$_COOKIE['passwd'];
$current_dir='/home/web/text';
$conn_id=ftp_connect("localhost",21);
$dir=$_REQUEST['dir'];
if(@ftp_login($conn_id,$user,$passwd))
{
   if(ftp_put($conn_id,"$put_file","$dir",FTP_BINARY))
   {
      echo 123;
   }
   else
   {
      echo 234;
   }
}
为什么这样写后,上传后有文件显示,但是文件的大小为0


------解决方案--------------------
$put_file 在哪里赋值的?
------解决方案--------------------
php的文件上传不是用$_POST处理的吧~我理解没错的话你是要先HTTP再FTP传~要弄清楚FTP是在服务器端进行的
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn