anonymous
anonymous

Reputation: 75

Put request in POSTMAN, laravel

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

Answers (7)

Phúc Nguyễn
Phúc Nguyễn

Reputation: 1

What you need to do is just:

  1. Select POST method
  2. Set _method = PUT in the body of Form-data enter image description here

Upvotes: 0

James Ikubi
James Ikubi

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

Ashutosh Kumar
Ashutosh Kumar

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" enter image description here

Upvotes: 0

Jithesh Jose
Jithesh Jose

Reputation: 1814

select form-data and select file type from the key box and change Text to File.

Check the Image

Upvotes: 0

Shailesh Ladumor
Shailesh Ladumor

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

Amit Senjaliya
Amit Senjaliya

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

enter image description here

Upvotes: 6

Usama Munir
Usama Munir

Reputation: 635

For PUT calls, try adding data in x-www-form-urlencoded

Upvotes: 1

Related Questions