I have a question about the django form save method.

Asked 2 years ago, Updated 2 years ago, 37 views

I want to receive the file url from the front desk, convert it into a file, and save it to fileField.

Receive the file url in POST format and override the form.py save() method

The process of extracting a file from the received url and storing the extracted file in db.

However, I implemented the file that was extracted by importing url on form.py

How do I load the foreign key to save to form.py and save it to db

It's very difficult.

How do I get the storage space (?) to store the files extracted from url at form.py? Can I get him?

django

2022-09-21 11:47

1 Answers

What you need to store in DB is not all binary content of the file, but The path that the file is served.

When I show the file to the users, I code it hard and spray it roughly.

<video src="
"></video>

(Advanced course) I think it's too much to store a video file on my server computer and stream it, so I use AWS.

(Advanced course) Check that it is mime-type, and save the file path in the IMG column when the user uploads jpg, and in the VID column when mp4 uploads.


2022-09-21 11:47

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.