Answers for "laravel flutter save image in data"

PHP
0

laravel flutter save image in data

public function uploadFile(Request $request) {
        if($request->hasFile('image')) {
            $name = time()."_".$request->file('image')->getClientOriginalName();
            $request->file('image')->move(public_path('images'), $name);
        }
        return response()->json([
            asset("images/$name"),
            201,
            'message' => asset("images/$name") ? 'Image saved' : 'Image failed to save'
        ]);
    }
Posted by: Guest on June-20-2021

Code answers related to "laravel flutter save image in data"

Browse Popular Code Answers by Language