File upload class-upload. php-PHP source code

Source: Internet
Author: User
Ec (2); & lt ;? Php ** & nbsp; * My File Upload Class & nbsp; * unfinished features: & nbsp; * 1. determine whether the target directory exists & nbsp; * 2. if duplicate names occur during the upload, auto rename & nbsp; * @ authorM. q. & lt; [url] www.mengqi.net [url] & gt; & nbsp; * classupload {& script ec (2); script


/**
* My File Upload class
*
* Unfinished functions:
* 1. Determine whether the target directory exists
* 2. If a duplicate name appears during the upload, it is automatically renamed.
*
* @ Author M.Q. <[url] www.mengqi.net [/url]>
*/
Class upload
{
/**
* Information of the uploaded file. This value is obtained by the constructor. If the file fails to be uploaded or has an error or has not been uploaded, this value is false.
*
* @ Var array
*/
Private $ file = false;


/**
* Constructor: obtains the information of the uploaded file.
*
* If an error occurs in the project where the file is uploaded, the error file will not be returned in the result, and all files in the result are available.
*
* @ Param string $ tag form Name attribute value in the tag, for example
*
* Example 1: Upload a single file:
*
*
* Example 2: upload multiple files:
*
*
*
* The result (saved in the $ file variable) is as follows:
*
* Array (
* [0] => array (
* ''Name'' => ''abc.txt''
* ''Type'' => ''text/plain'
* ''Tmp _ name'' => ''/tmp/phpgxecCb''
* ''Error'' => 0
* ''Size' => 62
*)
* [1] => array (
* ''Name'' & n

<

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.