uploadify无刷新上传图片
最后更新于:2022-04-01 23:50:21
> html
~~~
~~~
> php---'uploader': '{:U("organ/shop/upload")}',
~~~
public function upload(){
$upload = new \Think\Upload();// 实例化上传类
$upload->maxSize = 3145728 ;// 设置附件上传大小
$upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
$upload->rootPath = './'.C("UPLOADPATH"); // 设置附件上传根目录
$upload->savePath = './organ/'; // 设置附件上传(子)目录
$info = $upload->uploadOne($_FILES['Filedata']);
$info['savepath'] = substr($info['savepath'],1);
$path = $info['savepath'];
$name = $info['savename'];
if(!$info) {// 上传错误提示错误信息
$this->error($upload->getError());
}else{// 上传成功 获取上传文件信息
echo $path.$name;
}
}
~~~
';
建议尺寸: