ThinkPHP usage experience sharing-Usage of upload class UploadFile_PHP tutorial

WBOY
Release: 2016-07-13 10:29:40
Original
849 people have browsed it

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...

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!