Laravel : How to send image or file to API
<p>I have an API (created by Lumen) to save an image or file from client side.</p>

<p>this is my API code</p>

<pre><code>if ($request-&gt;hasFile('image')) {
    $image = $request-&gt;file('image');

    $fileName = $image-&gt;getClientOriginalName();
    $destinationPath = base_path() . '/public/uploads/images/product/' . $fileName;
    $image-&gt;move($destinationPath, $fileName);

    $attributes['image'] = $fileName;
}
</code></pre>

<p>I already try the API in postman, and everything went well, image sucessfully uploaded.</p>

<p>What's the best practice to send image from client side (call the API), and save the image in the API project ?
because my code isn't working..</p>

<p>This is my code when try to receive image file in client side, and then call the API.</p>

<pre><code>if ($request-&gt;hasFile('image')) {
    $params['image'] = $request-&gt;file('image');
}

$data['results'] = callAPI($method, $uri, $params); 
</code></pre>