Article From:

For example.

Because it’s writing


So I want to encapsulate a way of uploading files to ensure the simplicity of the code.

I found this one by the way.

Laravel How to call other methods in the controller

That is to say, in the controller, Post is used to transfer the value of Post to transfer the value. But it feels a bit troublesome.

So, what I want to ask is

Is there any better way to achieve this?

How do you usually achieve this kind of thing?

Answer 0:


public function store(Request $request)
    //default saved /storage/app/imgs/filename.jpg
    $savedFilePath = $request->file('input_field')->store('imgs');

Answer 1:

File store
Encapsulated file storage operations…

Answer 2:

I myself encapsulated a method to upload files, made the laravel extension package, can upload large files, including the front and back use more convenient, you can refer to the source code, I hope to help you…

Leave a Reply

Your email address will not be published. Required fields are marked *