Django Upload File

Simple upload file
os.path.join(BASE_DIR, 'myapp', 'templates')
myapp/templates/home.html
myapp/views.py
myapp/media
MEDIA_URL = '/media/' #newMEDIA_ROOT = os.path.join(BASE_DIR, 'myapp', 'media') #new
myapp/urls.py
myproject/urls.py
home
upload file
upload file success
uploaded file to media folder
File access via url (for image file will be show in folder, some format will be auto-downloaded)

--

--

--

Software Engineer, Indonesia

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Presearch Weekly Update #33 — September 17th, 2021

Python for Data Science — All about Lists

Use AWS Route53 Setup a Failover to Static Website on S3 Bucket

Gitlab — Platform for Developers to Collaborate

League of Legends challenges will arrive with patch 12.9

What the heck are Enums and why should I care?

Ten things you should know while using JPA

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adi Ramadhan

Adi Ramadhan

Software Engineer, Indonesia

More from Medium

[Django] Django development notes (2) Templates

Django Tutorial #2: URL Configuration

How Ajax Help Us To Communicate Between Django Html Page And Views

HTML -> AJAX -> Django -> AJAX ->HTML

Introduction to Django Framework

introduction to Django Framework