Django file upload form.

Sooraj Sahu (S3 Show)
2 min readMay 4, 2020

--

How to create a Django form to upload files.

Creating a Django form is quite looking a little difficult and a form to upload file is may look more complex.

But it is not, here is the step by step tutorial for creating a Django form.

Step 1:- Create a project.

Step 2:- Directory is looking like that

Now we need to make some changes in settings.py to add HTML pages.

Set ‘DIRS’: [‘templates’]

Also set template_dirs and media_root at end of setting .py.

Create a directory of name templates (Based upon the name given in setting.py file)

Step 4:- open the urls.py and edit into.

Step 5:- Create a file this file upload files uploaded from forms.html.

Step 7:- Create a directory media (where all the media will be store ), after all of that complete directory is look like that.

Finally, run the project.

Run command “python manage.py runserver”.

Server is created at http://127.0.0.1:8000/

Now open this at any browser and upload file.

upload any media hear.

It will save into media folder.

Thank you and support me 🙏🏻.

this is my first blog.

Github link is https://github.com/surajack12/Django-files-upload/

Originally published at https://medium.com on May 4, 2020.

--

--

Sooraj Sahu (S3 Show)
Sooraj Sahu (S3 Show)

Written by Sooraj Sahu (S3 Show)

I am an entrepreneurial thinker, painter, and a programmer. You can buy me a coffee on https://www.buymeacoffee.com/s3show :)

No responses yet