Thinkphp+smarty uploadify无刷新上传
程序员文章站
2022-04-19 08:18:23
...
很简单的一个上传demo,网上也有好多人写过,大家需要可以看看 无 !DOCTYPE htmlhtml lang="cn" head meta http-equiv="Content-Type" content="text/html; charset=utf-8" / link href="{$smarty.const.PUBLIC_PATH}/Uploadify/uploadify.css" rel="styleshe
很简单的一个上传demo,网上也有好多人写过,大家需要可以看看
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); } }