search
HomePHP LibrariesOther librariesPHP encapsulated image upload class
PHP encapsulated image upload class
<?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='不是一个有效的文件';
return false;
}
//判断文件是否上传到临时目录成功
switch($file['error']){
case 1:

This is a PHP-encapsulated image upload class. Friends who need it can download and use it

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

PHP image upload class (added thumbnail)PHP image upload class (added thumbnail)

06Jul2016

PHP image upload class (added thumbnail)

PHP image upload class with calling method, _PHP tutorialPHP image upload class with calling method, _PHP tutorial

12Jul2016

PHP image upload class with calling method attached. The php image upload class is attached with the calling method. The example in this article is to share the php image upload class for your reference. The specific content is as follows. The calling method: phpheader("Content-Type:text/html; charse

PHP upload image class and usage examples, _PHP tutorialPHP upload image class and usage examples, _PHP tutorial

12Jul2016

PHP upload image class and usage examples. PHP upload image class and usage examples. This article describes the PHP image upload class and usage examples. Share it with everyone for your reference, the details are as follows: 1. The class file name is: upclass.php phpclass up

Complete example of MSSql operation class encapsulated by PHP, mssql example encapsulated by PHP_PHP tutorialComplete example of MSSql operation class encapsulated by PHP, mssql example encapsulated by PHP_PHP tutorial

12Jul2016

Complete instance of MSSql operation class encapsulated by PHP, mssql instance encapsulated by PHP. Complete example of PHP encapsulated MSSql operation class, PHP encapsulated mssql example This article describes the PHP encapsulated MSSql operation class. Share it with everyone for your reference, the details are as follows: php/*MSSql operation class

PHP simple upload class sharing, PHP upload sharing_PHP tutorialPHP simple upload class sharing, PHP upload sharing_PHP tutorial

12Jul2016

PHP simple upload class sharing, PHP upload sharing. PHP simple upload class sharing, PHP upload sharing. The example in this article shares the PHP upload class for your reference. The specific content is as follows: phpclass UploadFile{ var $inputName; //Control name var

Flash php implements image uploadFlash php implements image upload

09Jul2016

Flash php implements image upload,

See all articles