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
3
votes
3 answers

Copy file into another folder with django?

I need to upload profile images into diferent folders in Django. So, I have a folder for each account, and the profile image have to go to the specific folder. How can I do that? Here is my uploadprofile.html
Sergio Mendez
  • 1,311
  • 8
  • 33
  • 56
3
votes
1 answer

Using a Django FileField in an inline formset

having issues getting the file to upload in my app. A User submits a report and can add attachments (through a foreign key relationship). I've got the inline form showing up and will work if I leave it blank, but when I try to upload a file then…
3
votes
0 answers

Django Class-based ViewCreate and ViewUpdate file upload

I have a project where I wish to upload an image with the Django auto generated class-based views, and it works on the admin side, but I don't know what I'm missing to make it work from an HTML page. I've searched the web with a little luck or not…
Sibris
  • 41
  • 5
3
votes
2 answers

Django: file field validation in model using python-magic

I have a model containing file field. I want to restrict it to pdf files. I have written clean method in model because I want to check for admin and shell level model creation also. But it is not working in model clean method. However form clean…
3
votes
1 answer

How to access file after upload in Django?

I'm working on a web. User can upload a file. This file is in docx format. After he uploads a file and choose which languages he wants to translate the file to, I want to redirect him to another page, where he can see prices for translations. The…
Milano
  • 18,048
  • 37
  • 153
  • 353
3
votes
1 answer

How to deal with temporary storage of uploaded files

In my django application I have a multi step registration, with few conditional parameters. Because of this I figured out to store data from forms in session. Unfortunatelly sessions serialize data using pickle, which doesn't support file…
tom_pl
  • 425
  • 2
  • 9
  • 16
3
votes
2 answers

django templates upload file - how to handle a non-existant physical file

I am using django to upload an image file to the server. When the user attempts to view a missing image in the django templates, there is just the broken image displayed, but I want to display a default missing image file. How do I handle the…
user3354539
  • 1,245
  • 5
  • 21
  • 40
3
votes
1 answer

Curl: HTTP/1.1 100 Continue message on File Upload

I'm uploading a file using curl in one of my django project, it works fine in localhost, but when I hosted the project in remote server, it does not work. I'm sending the file from this command curl -i --form docfile=@/path_to_file…
vaibhav1312
  • 863
  • 4
  • 13
  • 31
3
votes
2 answers

Locating file path from a Django object

I have a Django app which, submitting a package, should return values that are inside it.. Submitted the form to a view called "insert": request.FILES['file'] returns the file objects, but it is of kind < InMemoryUploadedFile>. What i need is a way…
PirosB3
  • 1,961
  • 1
  • 17
  • 21
3
votes
1 answer

Django: Upload Files and Save to Disk

I'm trying to upload some files through a form on my project and have the files save to disk. Currently, I am able to get the data to insert into the DB (postgreSQL), but the data is not being written to disk. I've done some looking around, and…
3
votes
1 answer

When editing an object in django the ImageField is not populated

I'm trying to edit an existing object through a form. Every thing is working fine except for the ImageField not being populated with the current value. Here's the model: class Post(models.Model): author = models.ForeignKey(User,…
silent1mezzo
  • 2,814
  • 4
  • 26
  • 46
2
votes
1 answer

Django FileField.save() makes duplicate files

I have user submitted content that I am trying to write to a file and then save to a FileField. so I have a model that looks like this: class Revision(models.Model): def custom_revision_file_path(instance, filename): return…
Daniel Nill
  • 5,539
  • 10
  • 45
  • 63
2
votes
1 answer

Use value of primary key in FileField upload_to function

Given the following model I am attempting to use the models ID field (a UUID) in the upload_to path but its defined as None, presumably as it hasn't been generated at that point. If I use a UUID field that isn't defined as the primary key it works…
Ryan
  • 23,871
  • 24
  • 86
  • 132
2
votes
1 answer

Django: how to upload media files to different folders?

I want to save file in automatically created folder related with Employee id_number like: media->employee->attachments->emp001->emp001.pdf models.py from django.db import models class Employee(models.Model): id_number =…
2
votes
1 answer

Reopening a closed django InMemoryFileUpload using class based views

I have a Django project which involves a user uploading a CSV file via a form. I parse this file in the forms clean method, and then in the views form_valid method I want to read the file data again (for the purposes of long term storage). My issue…