Home > Backend Development > PHP Tutorial > 在thinkphp的官方例子中file下传的图片保存不到Upload里

在thinkphp的官方例子中file下传的图片保存不到Upload里

WBOY
Release: 2016-06-13 13:01:19
Original
928 people have browsed it

求助 在thinkphp的官方例子中file上传的图片保存不到Upload里
我就下来之后建立了数据库 配置好数据库 之前的curd ajax form都可以用的 上传文件时 显示成功了 但是在Upload下没有保存图片 这是怎么回事啊?有相同问题的么?

D:\wamp\www\file\Uploads存图片的文件夹是这个
import('@.ORG.UploadFile');
//导入上传类
$upload = new UploadFile();
//设置上传文件大小
$upload->maxSize = 3292200;
//设置上传文件类型
$upload->allowExts = explode(',', 'jpg,gif,png,jpeg');
//设置附件上传目录
$upload->savePath = './Uploads/';
//设置需要生成缩略图,仅对图像文件有效
$upload->thumb = true;
// 设置引用图片类库包路径
$upload->imageClassPath = '@.ORG.Image';
//设置需要生成缩略图的文件后缀
$upload->thumbPrefix = 'm_,s_'; //生产2张缩略图
//设置缩略图最大宽度
$upload->thumbMaxWidth = '400,100';
//设置缩略图最大高度
$upload->thumbMaxHeight = '400,100';
//设置上传文件规则
$upload->saveRule = 'uniqid';



我都没做过其他修改  怎么就不会显示图片呢?  
新手求教
------解决方案--------------------
你的项目在 D:\wamp\www\file 中吗?
确认 D:\wamp\www\file\Uploads 有一般用户完全控制权
确认 D:\wamp\www\file\Uploads 的“允许存档”被勾选
------解决方案--------------------

	<br />
/*<br />
文件上传<br />
*/<br />
	function up()<br />
	{<br />
		import("@.ORG.UploadFile");<br />
		$upload = new UploadFile();<br />
		$upload->maxSize  = 10*500*1024 ;<br />
		$upload->thumb=false;<br />
		$upload->autoSub=true;<br />
		$upload->hashLevel=2;<br />
		$upload->subType="date";<br />
		$upload->dateFormat="Ymd";<br />
		$upload->saveRule="uniqid";<br />
		$upload->uploadReplace=false;<br />
		$upload->allowExts  = explode(',','png,jpg,jpeg,gif');<br />
		$upload->savePath = C('IMAGE_UPLOAD');<br />
		if($upload->upload()){<br />
			$info=$upload->getUploadFileInfo();<br />
			//dump($info);exit;<br />
			 <br />
			return $info;<br />
		}else {<br />
			$this->error($upload->getErrorMsg());<br />
		}<br />
	}
Copy after login

'IMAGE_UPLOAD' => '/DATA/html/ems/thumb/'
这个是路径
文件上传不了不是文件本身的问题,就是权限的问题 看你要上传的目录是否有权限

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