ThinkPHP upload file summary

WBOY
Release: 2016-08-08 09:20:27
Original
1230 people have browsed it

This article summarizes several methods of uploading files by combining js and php

  • Test environment Thinkphp3.2, phpStudy2014 (Apache + php 5.3)
  • No matter which method, you must first configure the php upload file size
    Open php.ini and modify the following three items:
    max_execution_time = longest execution time (0 means no limit)
    post_max_size = maximum size allowed
    upload_max_filesize = the maximum size of the uploaded file

Thinkphp uploads files directly

Thinkphp's own upload class, supports multiple file uploads, refer to the documentation
Note: The form tag needs to add enctype="multipart/form-data"

If you want to display the image without refreshing after uploading, you need to upload it with ajax, and then set src according to the returned image address. However, ajax cannot add enctype, so you need other method.

You can use iframe http://blog.csdn.net/hytfly/article/details/6267229
You can also use xhr http://updates.html5rocks.com/2012/04/Processing-XHR2-file-uploads-in-PHP

Thinkphp+uploadify to upload files

uploadify official website: http://www.uploadify.com /
An example that can be used for testing: http://www.thinkphp.cn/topic/30225.html

Thinkphp+plupload upload files

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

Copyright Statement : This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces the summary of files uploaded by ThinkPHP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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