我在文件上傳和文件方面遇到任何問(wèn)題JPG。但并非全部,我找不到任何原因... :-( 當(dāng)然,我嘗試先搜索,但沒(méi)有結(jié)果...我有一張來(lái)自網(wǎng)站的截屏圖像,在 Photoshop 中打開并保存為 JPG,未壓縮,質(zhì)量為 100。它在 Mac Finder 中正常工作,我可以打開圖像,它似乎沒(méi)有損壞(您是否見(jiàn)過(guò)損壞的打印屏幕:-))。當(dāng)我有另一張圖像(JPG)時(shí),在 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 }}上傳文件后,我有時(shí)會(huì)得到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 ))當(dāng)我嘗試上傳另一張圖像時(shí),轉(zhuǎn)儲(chǔ)是正確的并且文件已上傳。大批( [image] => Array ( [name] => team.jpg [type] => image/jpeg [tmp_name] => /private/var/tmp/phpc5wmkE [error] => 0 // no error [size] => 601807 // correct file size )任何想法?謝謝
- 1 回答
- 0 關(guān)注
- 137 瀏覽
添加回答
舉報(bào)
0/150
提交
取消