Home > php教程 > php手册 > Thinkphp+smarty+uploadify实现无刷新上传

Thinkphp+smarty+uploadify实现无刷新上传

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 19:50:11
Original
818 people have browsed it

这篇文章主要介绍了Thinkphp+smarty+uploadify实现无刷新上传的方法,实例分析了php模板与js上传插件结合实现无刷新上传的相关技巧,需要的朋友可以参考下

本文实例讲述了Thinkphp+smarty+uploadify实现无刷新上传的方法。分享给大家供大家参考。具体如下:

模板文件代码:

控制器代码:

public function uploads(){ $arr = array( "errorcode"=>"1","errormsg"=>"上传成功!"); $model = M('applicant'); if (!empty($_FILES)) { //图片上传设置 $config = array( 'maxSize' => 1000000, 'rootPath' => 'Public', 'savePath' => '/Uploads/', 'saveName' => array('uniqid',''), 'exts' => array('jpg', 'gif', 'png', 'jpeg'), 'autoSub' => false, 'subName' => array('date','Ymd'), ); $upload = new \Think\Upload($config);// 实例化上传类 $info = $upload->upload(); if($info){ $arr['errorcode'] = "0"; } else { $arr["errorcode"] = "1"; $arr["errormsg"] = $upload->getError(); } /* 返回JSON数据 */ $this->ajaxReturn($arr); } }

希望本文所述对大家的php程序设计有所帮助。

Related labels:
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
Latest Issues
Why thinkphp has better performance than laravel?
From 1970-01-01 08:00:00
0
0
0
ThinkPHP Why use composer?
From 1970-01-01 08:00:00
0
0
0
thinkphp versions supported by php6
From 1970-01-01 08:00:00
0
0
0
thinkphp upload files
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template