我在文件上傳和文件方面遇到任何問題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
提交
取消