pear http_upload文件上传库
Pear的HTTP_Upload类库提供了一个封装好的html表单文件上传处理程序,使用Pear的error系统。
特点
能一次处理多个文件的上传
容易校验文件的上传状态,限制不期望的文件上传
多语种的报错提示信息(还没有中文,不过可以扩展)
单个文件上传的例子
index.htm
PLAIN TEXTCODE:
files.phpPLAIN TEXTPHP: getFiles(‘userfile‘);// return a file object or errorif (PEAR::isError($file)) { die ($file->getMessage());}// Check if the file is a valid uploadif ($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 TEXTCODE:
PLAIN TEXTPHP: getFiles(); // returns an array of file objects or errorforeach ($files as $file) { if ($file->isValid()) { ... }}?>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号