A
A
Andrei1penguin12020-11-28 16:55:32
Django
Andrei1penguin1, 2020-11-28 16:55:32

How to save photos from the frontend to the database?

Good day, there is a task to save a photo from an input type file to postgresql via Django.
But when loading a photo into inout and sending a request to the server, input sends nothing.
Access to input goes through
photo=request.POST.get("photo_file", " "), where photo_file is the name of the input
photo comes empty
Forms of their own, it's important
How to fix the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-11-28
@Andrei1penguin1

(Tiredly) read the doc carefully, maybe another one who didn't register enctype, and yes, request.FILES

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question