How to Upload an Image Using Django ImageField (The RIGHT Way)

How to Upload an Image Using Django ImageField (The RIGHT Way)

Caleb Curry

2 года назад

37,355 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Bander
Bander - 20.09.2023 03:22

Hey Caleb thank you so much for the video! I am having a small problem on my end. When I determine the path of the files in the upload_to arg it doesn't save into the stores files unless i specifically say stores/images but when I do that the GET looks in stores/stores/images
I could just move the file over after it uploads to the file outside of the stores files but Im just curious what I am doing wrong.

Ответить
Yoel Gutierrez CPT
Yoel Gutierrez CPT - 12.08.2023 00:51

When I select choose file in the django admin to upload the image nothing happens 😟😟😟 I’ve been stuck here for hours, can’t find the error

Ответить
Praise Codes
Praise Codes - 20.07.2023 23:04

Bruh!!!!!!
This is exactly what i needed.. God Bless You.

Ответить
Hrishikesh Sonawane
Hrishikesh Sonawane - 14.07.2023 15:01

error: type object Movie has no attribute object

AttributeError
Please help

Ответить
Alexander Seydewitz
Alexander Seydewitz - 05.07.2023 21:45

Eres el mejor, enserio me ayudaste con algo que me tenía horas ocupado, gracias

Ответить
Dragoon Digital
Dragoon Digital - 14.05.2023 00:04

Oh man, that was so clear and simple. Imgs were always a bit confusing for me when it comes to Django. I'm definitely donating some $ once I'm not broke :D

Ответить
Rasp Lyv
Rasp Lyv - 01.05.2023 14:47

Спасибо, ты меня спас!!!

Ответить
Ali Alahdal
Ali Alahdal - 19.02.2023 17:14

Clear and good explanation , Thanks❤

Ответить
SO×Morgin
SO×Morgin - 17.01.2023 17:46

Thank You veru much!!!!
You realy help me to do this on my own

Ответить
Amir Iskandar
Amir Iskandar - 22.12.2022 20:57

IMPORTANT!! DO NOT USE THIS IN PRODUCTION. THIS IS UNSAFE.

People can view your whole code.

Great for debugging. But NOT for production. This is NOT the "correct" way.

Ответить
Arron
Arron - 19.12.2022 16:43

Thank you, my image was not showing but I had the model set as featured_image so {{ post.featured_image.url}} got it for me

Ответить
chawa phiri
chawa phiri - 13.12.2022 20:02

Thank you So Much for this Video. You are a lifesaver.

Ответить
Rgs Ma
Rgs Ma - 30.10.2022 15:04

Hi,
How is it to make ImageField() as optional where user is given the option to Upload or NOT to upload the image. I have been having problem to do just that on Django DRF APIView.

Ответить
Arun
Arun - 21.10.2022 17:55

Thank you for the video. May I know what VSCode extension are you using that prompt you with the Django imports tool tips?

Ответить
Ali Maher
Ali Maher - 25.08.2022 21:55

Great T-Shirt :)

Ответить
ruslanways
ruslanways - 24.07.2022 15:38

Great tutorial! Thank you!
p.s. could you show the same uploading image functionality, but to get an image from outer URL (from internet)? or maybe just give me an idea..

Ответить
Marcin
Marcin - 14.06.2022 15:20

The only place where I found answer how to make it :) Thanks a lot!

Ответить
Adfgejshcylwn Oaoxgoakwoxiow
Adfgejshcylwn Oaoxgoakwoxiow - 13.06.2022 11:41

thanks 😘

Ответить
Poorna chandu Challa
Poorna chandu Challa - 04.06.2022 17:14

Bro can u also do video of capturing a image(through laptop camera) and storing it Django please

Ответить
Duncan Gillespie
Duncan Gillespie - 02.05.2022 14:05

Thanks heaps for this Caleb

Ответить
Zylokai
Zylokai - 01.05.2022 17:49

MEDIA_ROOT = ""
MEDIA_URL = os.path.join(MEDIA_ROOT, "/")

That worked for me.

Ответить
MRM
MRM - 16.04.2022 14:34

Hi Caleb,

Can you do a video on future of django, I've heard that web 3.0 is taking over web 2.0. I mean block chain technology.

Is that really true ? Will django become unneeded?

Ответить
NOSTRA NOSTRA
NOSTRA NOSTRA - 16.03.2022 15:06

From freecodecamp (database design course)

Ответить
Daniel Laera
Daniel Laera - 10.03.2022 19:29

first and supporter!

Ответить