Reputation: 75
I am using the postman for an api creation for my laravel project. I have made POST requesting for uploading the video but now I am trying to make a PUT request.Other things are being updated in the table using it like title and name but I am not able to use any option to upload the file(image) for PUT request.And if I use form-data then nothings happens in this case.
Upvotes: 1
Views: 11088
Reputation: 1
What you need to do is just:
_method = PUT
in the body of Form-data
Upvotes: 0
Reputation: 2928
If using formdata, add this Key: _method and value: PUT, in the formdata. Then use POST as the request.
NB: This also supports Image uploading, give the key the name you want, then change text to File
Upvotes: 1
Reputation: 479
In postman, you can simply send a PUT request by changing the Request method near URL Bar.
For uploading files, select "form-data" as input in postman then you will see a panel to enter key-value pairs. Initially, you will notice that both the fields take text as input.
To upload a file from this panel, in the left box (where you are supposed to enter key name) check the rightmost corner. You can see the type of the box and then change it to file.
As soon as you change the key type, the value field will ask you to upload a file.
Edit 1: You can see in the screenshot here, where you need to change it from "Text" to "File"
Upvotes: 0
Reputation: 1814
select form-data
and select file type from the key box and change Text
to File
.
Upvotes: 0
Reputation: 7242
You need to use POST method for file uploading. cause PUT method not supporting file uploading. here is issue in official github repo of laravel. you can see here reply from laravel
Upvotes: 1
Reputation: 2945
You should be required the following changes.
1) In Headers
The Content-type
field has been set as multipart/form-data
in Headers.
2) Choose the File
option instead of text
from the dropdown on the right side.
3) add _method: PUT
in form-data
Upvotes: 6