当我尝试将图像文件上载到服务器时,它随机出现错误,有时它可以正常工作,而不会出现同一文件的问题。使用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