Home > Backend Development > PHP Tutorial > PHP file upload class (this class supports single or multiple file uploads) (1/2)_PHP tutorial

PHP file upload class (this class supports single or multiple file uploads) (1/2)_PHP tutorial

WBOY
Release: 2016-07-20 11:08:11
Original
1002 people have browsed it

PHP file upload class (this class supports single or multiple file uploads) /*** Class name: upfile * Function: Process file uploads * Description: This class handles single or multiple file uploads. When using this class, you only need to instantiate the class * Example:

/php tutorial file upload class (the Class supports single or multiple file uploads)




Untitled Document

< body>
//php file upload class (this class supports single or multiple file uploads)
/**
* Class name: upfile
* Function: processing File upload
* Note that this class handles single or multiple file uploads. When using this class, you only need to instantiate the class
* Example:
* $up = upfile()
* $up->update_file($_file['filename'])
*
* $up->update_file function returns an array, which is multi-dimensional data if multiple files are uploaded.
* Array content:
* $fileinfo['file_size'] Upload file size
* $fileinfo['file_suffix'] Upload file type
* $fileinfo['file_name'] Upload The name of the file
* $fileinfo['error'] The error caused by uploading the file
*

*/
class upfile {
public $fcount = 1;                                                                                                                                                                                                                                                       = array('jpg','jpeg','gif','png'); //File format
public $fsize = 1024; //File size unit kb
public $fdir = 'www.bkjia .com/'; // File Storage Directory
Public $ ERRORMSG =' '; // Temporary error information generated

/**

*Function name: get_tmp_file($putfile)
*Function: Get the uploaded temporary file name
*@param array $putfile
*@return string $upimg Returns the temporary file name
*/
Function get_tmp_file ($ public) {
if($this->fcount == 1){
$tmpfile = $putfile['tmp_name'];
}else{
for($i=0;$i< $this->fcount;$i++){
$tmpfile[] = $putfile['tmp_name'][$i];
}
}
return $tmpfile;
} 1 2

http://www.bkjia.com/PHPjc/444891.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444891.htmlTechArticlephp file upload class (this class supports single or multiple file uploads) /** * Class name: upfile * Function: Process file upload* Description, this class handles single or multiple file uploads. When using this class,...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template