lundi 24 octobre 2016

laravel change request after upload

Trying to update my request after uploading a file : (Laravel 5.3)

$path = Storage::disk('s3')->putFile($destination, $request->file($name)); // works $request->merge(array($name => $path)); // doesn't work $myModel->update($request->all())

I know i can't replace a File by a string in my request, so how am i supposed to do it ?

Saw a lot of posts on that but common, must be an easier way than a move() or a :

$res = $request->except($myInputFileName)->toArray() $res[$myInputFileName] = $path

Any pretty solution ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire