kc2001
kc2001

Reputation: 5239

Postman won't upload local file using PUT

We have a web service that does some cloud file manipulation. I can upload and copy files with HTTP PUT requests using clients such as Chrome and Windows Explorer. (We support WebDAV.) I can not upload a local file using Postman, although I can upload text into a file.

I've followed the advice from this question to create the following set up:

enter image description here

enter image description here

When I run the test, my web service receives the request. When I examine the request processing in the debugger, our code finds no content when it tries to read data from the request, so our code creates a file of 0 bytes. When I look at the Postman console, it looks as though the local file I specified to be uploaded isn't being found by Postman ("File: undefined"), even though I specified the file using the Postman UI. How can I get Postman to transmit the file?

enter image description here

UPDATE:

If I follow @steadweb's answer from the same question and disable the Content-Type header, I do get the text from the file, but I also get superfluous content. See below. The bold text below was from the original file that was uploaded. The plain text was not.

----------------------------841412509785409880235814 Content-Disposition: form-data; name="File"; filename="uploadedFileFromC.txt" Content-Type: text/plain

This file was uploaded from the local C drive.

----------------------------841412509785409880235814 Content-Disposition: form-data; name="_method"

PUT ----------------------------841412509785409880235814--

In this case too, the Postman console shows "File: undefined", so that information doesn't seem too useful.

Upvotes: 0

Views: 35

Answers (0)

Related Questions