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
<