Support file uploads also for HTTP PUT method

Hi, everybody!

Based on the documentation the out-of-the-box support for file uploads is only available for the HTTP POST method. I suggest this is extended also for the PUT method.

Reasons: When building a REST API interface one uses the PUT method for modification/updating resources. The “resource” might include some data as well as a file. While file uploads with the PUT method are generally possible the direct support in Django is missing and this might complicate building a REST interface in a consistent way.

My understanding is this could hardly break some existing functionality and the implementation would not be that complicated.

Regards,
Oto

1 Like

G’day Oto,

This has been requested before, see the comments in this ticket plus the linked mailing list threads: #12635 (Process HTTP PUT into request.FILES and request.PUT as done for POST) – Django

David

2 Likes

+1.

There’s also though a GSoC project to address #21442 (Configurable request parsing.) – Django this year. That should allow a parsed request.data for all request methods. (So if configured parsers include multipart file parsing, that this should well be supported at that point.)

1 Like

Hi, thanks for responding.

It looks I should have been more careful searching the forum not to duplicate topics, sorry for that. While I get the reasons for refusing the suggestion in the past I do not completely agree. I still believe that sending binary data with the multipart/form-data encoding is an efficient way of doing so, HTTP and web are not about browsers only and web browsers themselves can do (and really do so) lots of their requests with the PUT method (to REST services, e.g.) using JavaScript.

Anyway, thanks once more for your attention,
Oto

Hopefully the GSoC project should open the gate here. :crossed_fingers: