P
P
podust2015-02-05 03:33:15
Laravel
podust, 2015-02-05 03:33:15

How to get a list of all files uploaded through a form in Laravel?

The task before me was to find out which files were loaded from the form. I made a loader with automatic addition of standard input [ file ] fields, like this:
fe554a714eaa45a999c2879f51ec2405.png
I.e. the number of fields of type file [ input ] is unpredictable, and the names of uploaded files are also unpredictable.
Question: how to get an array of all files uploaded via POST in Laravel?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2015-02-05
@podust

Route::post('upload', function(){
    $files = Input::file('files');

    foreach($files as $file) {
                // public/uploads
        $file->move('uploads/');
    }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question