PATCH and PUT Request Does not Working with form-data

This is a known issue and the workaround suggestion as per the following Github comment is that when sending a PATCH / PUT requests you should do the following:

You should send POST and set _method to PUT (same as sending forms) to make your files visible

So essentially you send a POST request with a parameter which sets the actual method and Laravel seems to understand that.

As per the documentation:

Since HTML forms can't make PUT, PATCH, or DELETE requests, you will need to add a hidden _method field to spoof these HTTP verbs. The @method Blade directive can create this field for you:

<form action="/foo/bar" method="POST">
    @method('PUT')

    ...
</form> 

Alternatively, you can use the method_field helper function to do the above:

The method_field function generates an HTML hidden input field containing the spoofed value of the form's HTTP verb. For example, using Blade syntax:

<form method="POST">
    {{ method_field('PUT') }}
</form>

I learnt how to solve it here on this post and I'd like to share what did I do.

The following image is how I setup the Postman to send a HTTP POST request and go into PUT Request and make it receive my files.

I'm not sure whether it is the right way to do a RESTFul API. But it works fine

An example on Postman how to setup your HTTP Request


so as everyone mentioned above and explained everything, but still i dont see the answer for cases when using a REST API so i fallowed @Caique Andrade answer and send a POST request and formed my URL link like this:

url = 'https://yourwebsite.com/api/v1/users/$id?_method=PUT';

$id is the variable id for the user.

?_method=PUT is added to the url POST request to spoof the request and it works

in my case i used Dart in flutter and sent a post request using Http package Laravel catches that POST request as a PUT request