ThinkPHP file upload summary

Source: Internet
Author: User
: This article mainly introduces ThinkPHP file upload summary. if you are interested in the PHP Tutorial, please refer to it. This article summarizes several methods to upload files in combination with JavaScript and php.

  • Test environment Thinkphp3.2 and phpStudy2014 (Apache + php 5.3)
  • Either way, you must first configure the php file size to be uploaded.
    Open php. ini and modify the following three items:
    Max_execution_time = the longest execution time (0 indicates no limit)
    Post_max_size = maximum allowed size
    Upload_max_filesize = maximum size of the uploaded file

Thinkphp directly uploads files

The upload class provided by Thinkphp supports multifile Upload. For more information, see
Note: to add the form label, enctype = "multipart/form-data"

If you want to upload images without refreshing, you need to use ajax to upload the images, and then set src based on the returned Image address. However, you cannot add enctype to ajax. Therefore, you need other methods.

Iframe http://blog.csdn.net/hytfly/article/details/6267229 available
Xhr http://updates.html5rocks.com/2012/04/Processing-XHR2-file-uploads-in-PHP can also be used

Thinkphp + uploadify Upload files

Uploadify official website: http://www.uploadify.com/
An example of testing: http://www.thinkphp1.cn/topic/30225.html

Thinkphp + plupload Upload files

Plupload official website: http://www.plupload.com/

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

The above section introduces ThinkPHP's file upload summary, including some content, and hopes to help those who are interested in PHP tutorials.

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.