當我嘗試將圖像文件上載到服務器時,它隨機出現錯誤,有時它可以正常工作,而不會出現同一文件的問題。使用laravel上傳文件時發生未知錯誤
Symfony \ Component \ HttpFoundation \ File \ Exception \ FileException
The file "xxxxxx.jpg" was not uploaded due to an unknown error.
這是我的代碼:
if (Input::hasFile('thumbnail_image')){
// Upload Photo
$thumbnailImage = Input::file('thumbnail_image');
$filename = 'thumbnail.'.Input::file('thumbnail_image')->getClientOriginalExtension();
$destinationPath = 'training_product/article_id_'. $id .'/thumbnail_image';
$databasePath = '/adidas/public/training_product/article_id_'. $id.'/thumbnail_image';
$uploadFile = Input::file('thumbnail_image')->move($destinationPath, $filename);
$product->thumbnail_images_path = $databasePath.'/'.$filename;
$product->save();
}
您的laravel日誌文件是否包含任何有用的信息? – 2014-09-24 12:55:55
laravel日誌只是返回未知錯誤在線 $ uploadFile = Input :: file('thumbnail_image') - > move($ destinationPath,$ filename); 我猜這個文件沒有上傳,但我不知道哪個設置是錯誤的,爲什麼有時會工作,有時並不工作 – 2014-09-24 13:57:50
如果文件已經存在於目標位置,會發生什麼? – Gagan 2016-02-07 07:06:17