Questions tagged [django-file-upload]

Django-file-upload refers to how django handles file uploads

Django-file-upload refers to how django handles file uploads.

See documentation.

325 questions
0
votes
1 answer

Why is fileChoice.value() None?

I am working in Django 3.2.13 trying to create a simple upload form for a file model with a chained foreign key. I have tried creating a form with a basic form model and a ModelForm, however, even when checking request.FILES there is no data and…
0
votes
1 answer

form doesn't appear and how to remove
  • in django forms
  • i have problem. why my form doesn't show except i clicked submit button. is that any problem with my code? here's my html code :
    Monana
    • 43
    • 1
    • 5
    0
    votes
    1 answer

    DJANGO FORM - how to change save location file uploaded

    i don't use models form but only form. How to change location file when i uploaded? i want the file just go to /mp3 folder. And now it not move to anything (the file didn't got upload). and this my code : def homepage(request): if request.method ==…
    0
    votes
    1 answer

    how to change folder location to save file - DJANGO FileSystemStorage

    so i want when i upload a file, the file will go to media/mp3 not media/txt. how to change save file location? views.py: def homepage(request): if request.method == "POST": form = Audio_store(request.POST, request.FILES) if…
    0
    votes
    1 answer

    How to upload any type of file in Django?

    I want to accept any type of file from the user and save it in the database. I am using following code: In HTML file : But when I try to access the file in views.py it throws the Exception as…
    0
    votes
    2 answers

    django file opens locally but fails in server

    What I wanted to achieve was for a user to upload a file through a form, lets say profile picture, My aim is to take that file, send it through imgbb's api and get the image url to store for use in my template later. I was able to achieve this with…
    Sammy Dasaolu
    • 17
    • 1
    • 6
    0
    votes
    1 answer

    How do I upload a file in Django OneToOne Model's FileField using form?

    I have one model Detail which has OneToOne relation with default User Model. I have a field FileField in my Detail model, where I want to upload the files using forms from frontend/templates. I have been working around it a lot but I am not getting…
    0
    votes
    1 answer

    how to use font awesome icon as file upload input field for django template as bootstrap?

    I am using bootstrap as the template. The form is designed as the font awesome icon will be the file upload field in the design. Is there any way to do it? I have no idea about that. I am sharing the template code here. If anyone can help me, I will…
    0
    votes
    1 answer

    Why file extension validator is not working properly in django?

    I am trying to add a file extension validator in the Filefield of my model. But when I am adding a different extension file through my serializer it's adding the extensions I didn't put in my validators.py Here is the code so far # validators.py def…
    0
    votes
    1 answer

    Django howto progessively write data into a huge zipfile FileField

    I have a django model like this: class Todo(models.Model): big_file = models.FileField(blank=True) status = models.PositiveSmallIntegerField(default=0) progress = models.IntegerField(default=0) I'd like to do two operations: first…
    10000days
    • 13
    • 3
    0
    votes
    0 answers

    Django Form says image field is required meanwhile image is uploaded in Graphql Altair client

    I'm using GraphQL in a Django project and the Altair GraphQL client, and I'm facing an issue with file uploads. When the request is submitted via Altair, the submitted fields are detected in my ImageUploadMutation. After initialising the form with…
    ImportError
    • 358
    • 5
    • 17
    0
    votes
    1 answer

    Django FileField upload_to custom function error

    I have created a custom utility function for Django FileField's upload_to parameter. This function accepts a prefix and returns a function that actually accepts instance and filename. But when I run manage.py makemigrations, the command throws…
    Atharva Kale
    • 59
    • 1
    • 9
    0
    votes
    1 answer

    Django channels and file uploads

    I'm learning Django on the fly so bear with me. My goal here is for a user to be able to upload a file, the server script process it and send the results on each iteration to the client live. My current structure is: User uploads a file (csv), this…
    ky922
    • 51
    • 7
    0
    votes
    1 answer

    How to associate newly created file model

    I have this code, @receiver(post_save, sender=FileAnswer) def save_category_signals(sender, instance, **kwargs): file_types = ["image", "image-multiple"] file_type = instance.question.form_input_type if file_type in file_types: …
    Martins
    • 1,130
    • 10
    • 26
    0
    votes
    1 answer

    How to check if FileField was uploaded?

    I wanna store the "original" file name of an upload. This is because the file gets stored with a uuid as a new name. So I wrote this for my model: def save(self, *args, **kwargs): if self.file: self.original_filename =…
    JasonTS
    • 2,479
    • 4
    • 32
    • 48