Closed reasecret closed 2 years ago
Solved.
foreach (request('upload') as $key => $item) {
$publicFilePath = str_replace(storage_path(), "", $event->path());
File::create([
'file_mime_type' => $item->getMimeType(),
'file_extension' => $item->getClientOriginalExtension(),
'file_original_name' => $item->getClientOriginalName(),
'file_size' => $item->getSize(),
'file_path' => $publicFilePath,
]);
}
I'm trying to save image data to database. But don't know how to get file size, file extension and file name on my event listener. I can get only file path. Anyone tried something like this?