<?php //封裝php中的單文件(圖片)上傳類 header('content-type:text/html;charset=utf-8'); class Upload{ //定義一個(gè)屬性,專門保存錯(cuò)誤信息 public static $error; //文件轉(zhuǎn)移的方法 public function uploadFile($file,$size,$path){ if(!is_dir($path)){ $this->mkPath($path); } $allow=array('image/jpeg','image/jpg','image/png','image/gif'); //首先判斷文件是否已上傳到臨時(shí)目錄 if(!is_array($file)){ Upload::$error='不是一個(gè)有效的文件'; return false; } //判斷文件是否上傳到臨時(shí)目錄成功 switch($file['error']){ case 1:
This is a PHP-encapsulated image upload class. Friends who need it can download and use it
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

12 Jul 2016
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

12 Jul 2016
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

12 Jul 2016
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

12 Jul 2016
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


Hot Tools

PHP library for dependency injection containers
PHP library for dependency injection containers

A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking

Small PHP library for optimizing images
Small PHP library for optimizing images
