S
S
stayHARD2015-08-16 12:43:57
Django
stayHARD, 2015-08-16 12:43:57

How can I validate an image in a POST?

Hello.
I'm writing an API using Django Rest Framework.
Wrote a method that saves a picture that comes in a POST request.
How can I check it?
If everything is clear with text data, then what about files, in this case with an image?
I tried to create an html file with the form and the fields that the method accepts, but then it swears at the csrf token, which is not in the form.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dimonchik, 2015-08-16
@dimonchik2013

python2or3.blogspot.com/2015/05/blog-post.html

Z
zelsky, 2015-08-16
@zelsky

through the extension i.e. jpeg png or svg . A more detailed question, but somehow it's not very clear

D
Dmitry Filimonov, 2015-08-16
@DmitryPhilimonov

Write a test .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question