Laravel-从上传的文件中获取大小

问题描述:

我已使用此命令保存了文件

I have saved a file with this command

$newFile = [
            'event_id' => $event->id,
            'path' => $storePath
           ];

EventFile::create($newFile);

我可以通过以下链接获取文件的路径:

I can get the path to the file for a link like this:

Storage::disk('public')->url($file->path);

但是没有有关文件大小的数据.如何在刀片视图中获取文件大小?

But there is no data about the file size. How can i get the file size in blade view???

Laravel 5

$request->file('file')->getSize();

Laravel 4

$request->file('file')->getClientSize(); // getClientSize() is deprecated in Laravel 5