ftp_put老是出错

lentonnet 2007-08-07 10:02:25
以下是上传代码:
---------------------------
<?php
require_once('SysCLS/ftp.class.php');
if($_POST){
$f=$_FILES["fileField"];
$dest_dir="./uploadfile";//设定上传文件的保存目录
$dest_fname=date("ymdGis").$f["name"];
$fname=$dest_dir."/".$dest_fname;
move_uploaded_file($f["tmp_name"],$fname);
chmod($fname,0755);
$newftp=new SunFTP('www.publicart.cn',21,'cofee','cofee.cc');
$newftp->UploadFileOrFolder('/uploadfile/070807135703200749222654624.jpg','/inc/070807135703200749222654624.jpg');
$newftp->quitftp();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>

<body>
<form id="form1" name="form1" enctype="multipart/form-data" method="post" action="">
<input type="file" name="fileField" id="fileField" />
<input type="submit" name="button" id="button" value="提交" />
<input name="action" type="hidden" id="action" value="a" />
</form>
</body>
</html>









以下是上传类:
帮帮看下哪里错误啊???????????????
class SunFTP{
private $hostName;
private $intport;
private $loginname;
private $loginpwd;
private $connid;
private $connResult;
private $strMSG;

public function __get($property_name){
if(isset($this->$property_name)){
return $this->$property_name;
}else{
return NULL;
}
}

public function __set($property_name,$value){
$this->$property_name=$value;
}

public function __construct($hostName,$intport=21,$loginname,$loginpwd){
$this->hostName=$hostName;
$this->intport=$intport;
$this->loginname=$loginname;
$this->loginpwd=$loginpwd;
}
public final function Connect(){
$this->connid=@ftp_connect($this->hostName,$this->intport);
//$this->connid=@ftp_ssl_connect($this->hostName);//require security
$this->connResult=@ftp_login($this->connid,$this->loginname,$this->loginpwd);
if((!$this->connid) || (!$this->connResult)){
$this->strMSG='FTP服务器连接失败!';
}else{
$this->strMSG='FTP服务器连接成功!';
}
return $this->connResult;
}

//文件夹区域结束------------------------------------------------------
public final function UploadFileOrFolder($remotefile,$localfile){
echo $remotefile.'------------'.$localfile;
$getback=ftp_put($this->connid,$remotefile,$localfile,FTP_ASCII);
return $getback;
}

}
...全文
344 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lentonnet 2007-08-08
  • 打赏
  • 举报
回复
唉,自己解决了
要分的来吧
lentonnet 2007-08-07
  • 打赏
  • 举报
回复
/uploadfile/070807135703200749222654624.jpg------------/inc/070807135703200749222654624.jpg
Warning: ftp_put() expects parameter 1 to be resource, null given in E:\源代码\PHP\myshop\SysCLS\ftp.class.php on line 78


这个是错误信息,看不懂啊

21,880

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧