您好,欢迎访问一九零五行业门户网

Pear:HTTP_Upload简介_PHP教程

pear的http_upload类库提供了一个封装好的html表单文件上传处理程序,使用pear的error系统。
特点
能一次处理多个文件的上传
容易校验文件的上传状态,限制不期望的文件上传
多语种的报错提示信息(还没有中文,不过可以扩展)
单个文件上传的例子
index.htm
plain text
code:
file1:
files.php
plain text
php:
getfiles(userfile);
// return a file object or error
if(pear::iserror($file)){
   die($file->getmessage());
}
// check if the file is a valid upload
if($file->isvalid()){   // this method will return the name of the file you moved,  
   // useful for example to save the name in a database  
   $file_name=$file->moveto(./uploads_dir/);
   if(pear::iserror($file_name)){
       die($file_name->getmessage());
   }
}
?>
多文件上传的例子
plain text
code:
image1:
image2:
image3:
plain text
php:
getfiles();// returns an array of file objects or error
foreach($filesas$file){
   if($file->isvalid()){
      ...  
   }
}?>
下载
http://pear.php.net/package/http_upload版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明
作者:volcano发表于8月 30, 2006 at 9:58 am
版权信息:可以任意转载, 转载时请务必以超链接形式标明文章原始出处和作者信息及此声明
永久链接 - http://www.ooso.net/index.php/archives/240
http://www.bkjia.com/phpjc/486637.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/486637.htmltecharticlepear的http_upload类库提供了一个封装好的html表单文件上传处理程序,使用pear的error系统。 特点 能一次处理多个文件的上传 容易校验文件的上...
其它类似信息

推荐信息