Put file contents instead of file object (creates subdirectory with a single file) (#6760)

This commit is contained in:
Steffen 2019-03-05 21:08:18 +01:00 committed by snipe
parent 27280b8866
commit de39906cae

View file

@ -37,7 +37,7 @@ class AssetFilesController extends Controller
foreach ($request->file('file') as $file) {
$extension = $file->getClientOriginalExtension();
$file_name = 'hardware-'.$asset->id.'-'.str_random(8).'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$extension;
Storage::put('private_uploads/assets/'.$file_name, $file);
Storage::put('private_uploads/assets/'.$file_name, file_get_contents($file));
$asset->logUpload($file_name, e($request->get('notes')));
}
return redirect()->back()->with('success', trans('admin/hardware/message.upload.success'));