【文件属性】:
文件名称:php封装的图片上传类.zip
文件大小:2KB
文件格式:ZIP
更新时间:2022-07-31 03:37:52
类库下载-php封装的图片上传类
<?php
//封装php中的单文件(图片)上传类
header('content-type:text/html;charset=utf-8');
class Upload{
//定义一个属性,专门保存错误信息
public static $error;
//文件转移的方法
public function uploadFile($file,$size,$path){
if(!is_dir($path)){
$this->mkPath($path);
}
$allow=array('image/jpeg','image/jpg','image/png','image/gif');
//首先判断文件是否已上传到临时目录
if(!is_array($file)){
Upload::$error='\u4e0d\u662f\u4e00\u4e2a\u6709\u6548\u7684\u6587\u4ef6';
return false;
}
//判断文件是否上传到临时目录成功
switch($file['error']){
case 1:这是一个php封装的图片上传类,需要的朋友可以下载使用
【文件预览】:
php封装的图片上传类
----php中文网下载站.url(114B)
----upload.php(2KB)
----php中文网免费下载站.txt(219B)