- 7
- 0
- 约4.48千字
- 约 3页
- 2021-01-13 发布于山东
- 举报
本文讲述了 thinkphp3.2 实现上传图片的控制器方法。分享给大家供大家参考,具体如
下:
public function file()
{
nbsp; $baseUrl = str_replace(\\, /, dirname($_SERVER[SCRIPT_NAME])); nbsp; import(ORG .Net.UploadFile);
nbsp; import(ORG .Util.Services_JSON);
nbsp; $upload = new UploadFile();
nbsp; $upload-gt;maxSize = 3145728;
nbsp; $upload-gt;allowExts = array(jpg, gif, png, jpeg);
nbsp; $upload-gt;savePath = ./uploads/Images/;
nbsp; $info = $upload-gt;uploadOne($_FILES[imgFile]);
nbsp; $file_url = $baseUrl . uploads/Images/ . $info[0][savename]; nbsp; if ($info) {
nbsp; nbsp;header(Content-type: text/html; charset=UTF-8); nbsp; nbs
原创力文档

文档评论(0)