Using the upload class is very simple. If you are using the upload function for the first time, please note that the form attributes in the html submission form must be added with the enctype attribute, such as:
Copy code The code is as follows:
ThinkPHP’s UploadFile class is in the file ../ThinkPHP/Extend/Library/ORG/Net/UploadFile.class.php:
Copy code The code is as follows:
;
// Instantiate the UploadFile class Only
$upload->saveRule = 'uniqid'; using using using d.
$upload-> thumb = true;
//Set the file prefix for which thumbnails need to be generated
'm_,s_'
// Set the maximum width of the thumbnails
$upload->thumbMaxHeight = '200';
//Delete the original image
$upload->thumbRemoveOrigin = true;
//Upload failure returns error message
if(! $upload->upload()){
$this->error($upload->getErrorMsg()); );
//Get uploaded file information
After setting up, you can easily upload files. At the same time, $upload's getUploadFileInfo can obtain the information of the uploaded file.
http://www.bkjia.com/PHPjc/770584.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/770584.html
TechArticle
The use of the upload class is very simple. If it is the first time to use the upload function, you need to pay attention to the html submission form. The form attributes in should be added with the enctype attribute, such as: Copy the code, such as...