samedi 31 octobre 2015

Processing multiple files in Laravel 5.1 (as an API)

So this seems like a pretty basic thing but I can't find a lot of documentation online about what's going on....

I'm trying to run through a list of files using Laravel 5.1 and I can only return/process/see the first file. I'm using Postman to send the request to the API (so I know multiple is enabled in the POST request) and then iterating through that a few different ways:

public function files(Request $request)
{
    foreach($request->files as $file)
    {
        var_dump($file);
    }
}

even:

public function files()
{
    foreach($_FILES['files'] as $file)
    {
        var_dump($file);
    }
}

I'm always returning:

string 'Screen%20Shot%202015-10-23%20at%2010.07.23%20AM.png' (length=51)
string 'image/png' (length=9)
string '/tmp/phpZw1ALu' (length=14)
int 0
int 13687

Why is this happening? What can I do to see multiple files in Laravel 5.1's controllers?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire