PHP File Upload Class (this class supports single or multiple file uploads) _php tutorial

Source: Internet
Author: User
Tags php file upload
PHP File Upload Class (this class supports single or multiple file uploads)/** * Class Name: Upfile * Function: Handle File Upload * Description, this class handles single or multiple file uploads, when using this class, only the class is required to be instantiated:

/php Tutorial File Upload Class (this class supports single or multiple file uploads)




Untitled Document


PHP File Upload Class (this class supports single or multiple file uploads)
/**
* Class Name: Upfile
* Role: Processing file Upload
* Description, this class handles single or multiple file uploads, and when you use the class, you only need to actually list the class
Cases
* $up = Upfile ()
* $up->update_file ($_file[' filename ')
*
* $up The->update_file function returns an array, or multidimensional if it is a multi-file upload.
* Contents of the array:
* $fileinfo [' file_size '] upload file size
* $fileinfo [' file_suffix '] type of upload file
* $fileinfo [' file_name '] name of the uploaded file
* $fileinfo [' ERROR '] errors generated by uploading files
*

*/
Class Upfile {
public $fcount = 1; Number of uploaded files
Public $ftype = array (' jpg ', ' jpeg ', ' gif ', ' PNG '); File format
Public $fsize = 1024; File Size Unit kb
Public $fdir = ' www.bkjia.com/'; File storage Directory
Public $errormsg = '; The resulting temporary error message

/**
* Function Name: Get_tmp_file ($putfile)
* Function: Obtain the uploaded temporary file name
* @param array $putfile
* @return string $upimg Returns a temporary file name
*/
function Get_tmp_file ($putfile) {
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.html www.bkjia.com true http://www.bkjia.com/PHPjc/444891.html techarticle php File Upload class (this class supports single or multiple file uploads)/** * Class Name: Upfile * Function: Handle File Upload * Description, this class handles single or multiple file uploads, when using this class, ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.