我在文件上传和文件方面遇到任何问题JPG。但并非全部,我找不到任何原因... :-( 当然,我尝试先搜索,但没有结果...我有一张来自网站的截屏图像,在 Photoshop 中打开并保存为 JPG,未压缩,质量为 100。它在 Mac Finder 中正常工作,我可以打开图像,它似乎没有损坏(您是否见过损坏的打印屏幕:-))。当我有另一张图像(JPG)时,在 Photoshop 中打开它,重新保存并尝试上传,文件已正确上传。上传脚本被缩短为此代码$files = [$_FILES['image'], $_FILES['imageHP']];foreach ($files as $src) { $path = ''; $name = prettyname($src['name']) . '-' . substr(time(), -4) . '.' . strtolower(pathinfo($src['name'], PATHINFO_EXTENSION)); // prettyname just make cool image name, strtolower, no spaces, accents, etc. if (!move_uploaded_file($src['tmp_name'], __DIR__ . "/../uploads/" . $path . 'orig_' . $src['name'])) { die ('Corrupted file'); // without this condition it the same }}上传文件后,我有时会得到Array( [image] => Array ( [name] => centrum.jpg [type] => image/jpeg [tmp_name] => /private/var/tmp/phpzDyQE4 // file should be uploaded? [error] => 0 // strange error = 0 [size] => 0 // strange, size = 0 ))当我尝试上传另一张图像时,转储是正确的并且文件已上传。大批( [image] => Array ( [name] => team.jpg [type] => image/jpeg [tmp_name] => /private/var/tmp/phpc5wmkE [error] => 0 // no error [size] => 601807 // correct file size )任何想法?谢谢
添加回答
举报
0/150
提交
取消