Posts

Showing posts from May, 2021

file upload django

 # vi settings STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, "static/") #Manage static for IMS MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') -------------------------------------------------------------------------------- # vi urls.py   project wale me path('useraccess/',include('useraccess.urls')), ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ------------------------------------------------------------ # vi models  app wala model hai ye Create your models here. class Document(models.Model):     title = models.CharField(max_length = 30, default="")     uploadedFile = models.FileField(upload_to = "useraccess/file",default="")     dateTimeOfUpload = models.DateTimeField(auto_now = True) ---------------------------------------------------------------------------- # vi HTML  <form action="." method="POST" enctype="multipart/form