我上传文件,默认上传的文件名设置为hashName()
。如何将其设置为自定义?
$uploadfiles = $request->file('file');
foreach ($uploadfiles as $key => $value) {
$file = $value->store('public/fca_files');
//Something like $value->store('public/fca_files','May 2, 2018 Report.xlsx');
$file_name_before = $value->getClientOriginalName();
$file_ext = $value->getClientOriginalExtension();
$file_name_after = $value->hashName();
$file_size = $value->getClientSize();
...
答案 0 :(得分:2)
您可以使用storeAs()并在第二个参数
中传递文件名$file = $value->storeAs('public/fca_files', 'Your filename');