Transfer a file to httpserver via POST command from curl

musbur at posteo.org musbur at posteo.org
Sun Dec 22 12:18:38 EST 2019


On Wed, 18 Dec 2019 04:52:33 +1100
Chris Angelico <rosuav at gmail.com> wrote:

> On Wed, Dec 18, 2019 at 4:45 AM <musbur at posteo.org> wrote:
> > BTW, the canonical way to upload files via http is PUT, not POST.
> > You might want to look into that, but here it is off-topic.  
> 
> Citation needed.

https://tools.ietf.org/html/rfc2616#page-55
	
> Plenty of file uploads are done through POST
> requests.

Of course. Both work. It's just that the OP wanted to "upload a large
binary file" using curl and in such cases I find that PUT can make for
a cleaner, simpler interface. 

> Are you talking specifically about a RESTful API? Because
> that's only one of many patterns you can follow.

Sure. It's just that people sometimes aren't even aware of http
methods besides GET and POST, and there's a chance for the OP
to investigate this and maybe to find that PUT fits his needs better
than POST in this case.


More information about the Python-list mailing list