脚本宝典收集整理的这篇文章主要介绍了php – move_uploaded_file不起作用,没有错误,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
>< form>使用method =“post”并更正enctyPE
>从表单引用的正确文件
>目录具有权限777
>所有memory_limIT,max_execution_time等都设置为超高设置以避免超时
基本上,下面的脚本返回只是你的图像太大..我也启用了所有错误显示,仍然没有出错.有任何想法吗?
$time = time(); $target_path = "/absolute/path/to/temp/directory/temp/"; $target_path = $target_path.$time.'.jpg'; if(move_uploaded_file($_FILES['image']['tmp_name'],$target_path)) { } else{ $error .= '<li>Your image is too Big.</li>'; }
使用1and1托管与PHP.ini hack:P
更新1
我想补充说,脚本的响应恰好在60秒后发生.
更新2
我们可能会遇到这个问题.只是PRint_r($_ FILES),这是数组的结果:
Array ( [image] => Array ( [name] => P2120267.JPG [type] => [tmp_name] => [error] => 1 [size] => 0 ) )
那么这让我相信文件没有正确上传到服务器或什么的?我已经检查过,帖子表格是< form action =“”method =“post”enctype =“multipart / form-data”>.那么,据我所知,该文件没有上传到服务器的临时区域?
更新3
注意到[错误] =>上面的数组中的1.这显然低至the filesize being larger than the upload_max_filesize
.然而,当我将其设置为128M时,我在60秒后获得了白屏死机.我上传的文件是2.5MB
register_globals=off memory_limit = 128M max_execution_time=3600 post_max_size = 128M upload_max_filesize= 128M
更新4
有了上面的详细信息,我似乎得到了一个WSOD,但图像正在被上传.那么,如何阻止WSOD?我无法找到任何相关的错误.
更新5 – 发现它!
resizeimage($FeedBurnerstatsSource,PHOTOMSGDIR.'temp/'.$time.'-tmp.jpg',$width,$height);
在以下代码中:
function resizeImage($source,$destination = NULL,$wdt,$height = NULL){ if(empty($height)){ // Height is nit set so we are keeping the same aspect ratio. list($width,$height) = getimagesize($source); if($width > $height){ $w = $wdt; $h = ($height / $width) * $w; $w = $w; }else{ $w = $wdt; $h = $w; $w = ($width / $height) * $w; } }else{ // Both width and Height are set. // this will reShape to the new sizes. $w = $wdt; $h = $height; } $source_image = @file_get_contents($source) or die('Could not open'.$source); $source_image = @imagecreatefromstring($source_image) or die($source.' is not a valid image'); $sw = imagesx($source_image); $sh = imagesy($source_image); $ar = $sw/$sh; $tar = $w/$h; if($ar >= $tar){ $x1 = round(($sw - ($sw * ($tar/$ar)))/2); $x2 = round($sw * ($tar/$ar)); $y1 = 0; $y2 = $sh; }else{ $x1 = 0; $y1 = 0; $x2 = $sw; $y2 = round($sw/$tar); } $slate = @imagecreatetruecolor($w,$h) or die('Invalid thumbnail dimmensions'); imagecopyresampled($slate,$source_image,$x1,$y1,$w,$h,$x2,$y2); // If $destination is not set this will output the raw image to the browser and not save the file if(!$destination) header('Content-type: image/jpeg'); @imagejpeg($slate,$destination,75) or die('Directory permission problem'); ImageDestroy($slate); ImageDestroy($source_image); if(!$destination) exit; return true; }
所以,WSOD意味着它的某种模具没有消息.有任何想法吗?
以上是脚本宝典为你收集整理的php – move_uploaded_file不起作用,没有错误全部内容,希望文章能够帮你解决php – move_uploaded_file不起作用,没有错误所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。