File Upload

14 views
Skip to first unread message

Williams Andy Inc

unread,
Sep 4, 2021, 5:46:14 AMSep 4
to Django users
Hi i am am trying to upload a file through a function but not the form and am facing difficulties 

how do i upload a file from server path without using the template form or forms.form

```class Image(models.Model):
    name = models.CharField(max_length=40, blank=True, unique=True)
    image_file = models.FileField(upload_to="images/")
    created = models.DateField(auto_now_add=True)
    updated = models.DateField(auto_now=True)

    def __str__(self):
        return self.name```


Reply all
Reply to author
Forward
0 new messages