gpt4 book ai didi

php - move_uploaded_file 失败 -- 没有错误消息

转载 作者:行者123 更新时间:2023-12-04 05:07:36 24 4
gpt4 key购买 nike

根据PHP.net documentation , 如果 move_uploaded_file失败而没有错误,这是因为它无法打开原始文件,但据我所知,该文件存在并可通过代码访问。有谁知道是什么导致了这个问题?

这是命令:

    if(!move_uploaded_file($file["tmp_name"],
SITE_ROOT."/../static/images/photos/tmp/".$fileName.$fileExt)) {
throw new Exception("ERROR: There was a serious server problem uploading the image :(");
} else {
return true;
}

这是创建 $newImage 的地方:
if(imagejpeg($img_dst, sys_get_temp_dir()."/tmp.jpg", 100)) {    
$newImage["name"] = "tmp.jpg";
$newImage['tmp_name'] = sys_get_temp_dir()."/tmp.jpg";
$newImage['error'] = 0;
$newImage['type'] = "image/jpeg";
$newImage['size'] = filesize(sys_get_temp_dir()."/tmp.jpg");

我什至可以查看系统临时目录中的文件,但即使 filesize()可以看, move_uploaded_file似乎有问题。

日志文件是空的(除了 MIME 警告: Cannot get media type from 'x-mapp-php5' )。任何人都知道发生了什么?

编辑 : 请问是不是跟这个有关系? (来自文档。)

move_uploaded_file() ensures the safety of this operation by allowing only those files uploaded through PHP to be moved.



编辑:是的,就是这样。

最佳答案

也许它与您访问的文件夹的权限有关

关于php - move_uploaded_file 失败 -- 没有错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15322240/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com