【发布时间】:2012-03-14 23:56:18
【问题描述】:
我正在使用此代码上传文件,但是当我将文件上传到一个文件夹时它可以工作,但是当我想将文件上传到文件夹内的文件夹时,它不起作用,如下面的代码..
$imageFile = $_FILES['origialImg']['tmp_name'];
$filename = basename( $_FILES['origialImg']['name']);
if(strstr($_FILES["origialImg"]["type"],"image")){
list($width, $height) = getimagesize($imageFile);
$src = imagecreatefromjpeg($imageFile);
$orig_h = ($height/$width)* $orig_w;
$tmp = imagecreatetruecolor($orig_w, $orig_h);
imagecopyresampled($tmp, $src, 0,0,0,0,$orig_w,$orig_h,$width,$height);
imagejpeg($tmp, $folder1."/".$folder2."/".$filename,100);
imagedestroy($tmp);
imagedestroy($src);
编辑
是的,这是错误报告
Warning: imagejpeg(): Unable to open 'images/big/216389_10150266713175744_609155743_9327201_766531_n.jpg' for writing: Permission denied in /var/www/GazaPlaces/account/photos.php
【问题讨论】:
-
那么
$folder1和$folder2中有什么。这些文件夹是否存在于您的服务器上?您收到任何错误消息吗?你设置了 error_reporting 和 display_errors 吗?