在laravel中上传CSV文件时,出现错误提示
“ Symfony \组件\ HttpFoundation \ File \ Exception \ FileException 由于出现未知错误,未上传文件“ DealProducts.csv”。
$folder = 'owner';
$path1 = base_path('resources/importedfiles/' . $folder . '/');
File::makeDirectory($path1, 0777, true, true);
$file = request()->file('file_name');
$fileName = md5($file->getClientOriginalName()) . '_' . date('Y-m-d H:i:s') . '.csv';
$uploadingPath = asset('resources/importedfiles/' . $folder . '/');
if ($file->move($path1, $fileName)) {
$offers = $request->get('offers');
ImportFile::create([
'file_name' => $fileName,
'file_size' => round($file->getClientSize() / (1024 * 1024), 2),
'offer_id' => $offers,
]);
}
return redirect('/admin/importfiles');
答案 0 :(得分:0)
在php.ini文件中,更改以下内容
upload_max_filesize = 20M
post_max_size = 20M
这可能有帮助。