1

I have a 3rd side service which making a POST request with file to my Django application.To success upload to Django application request must have 'multipart/form-data' content type but content type is 'octet-stream' in my case and Request.FILES is always empty. How can i receive file with 'octet-stream' content type in django?

request.content_type # is octet-stream 
form = UploadFileForm(request.POST, files=request.FILES)
file = form.cleaned_data[file_name]

1 Answer 1

2

If anybody stuck too I found a some solution. You can just read data as bytes and then save it to file

with open(file_name, 'wb') as output:
    output.write(request.read())
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.