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
1
vote
1 answer

Django Fileupload With Email

I am trying to attach a file with a contact form. My code looks like this for the form and view: if request.method == 'POST': form = UploadCVForm(request.POST, request.FILES) if form.is_valid(): # All validation rules pass subject =…
Harry
  • 13,091
  • 29
  • 107
  • 167
1
vote
2 answers

Django form not valid (form.is_valide() return False) on AJAX request

I have a form for a model which contains ImageField and i want user to be able to submit image via AJAX. Problem is that form.is_valide() returns False. When i dont use AJAX everything seems to be okay. I tried couple of SO answers on similar…
4evertoblerone
  • 95
  • 1
  • 3
  • 12
1
vote
2 answers

Is an uploaded image, a static file in Django?

I am developing an app in Django 1.6 and would like to know if the photos that I upload via the admin interface are "static files" in Django terminology. I have this model: from django.db import models class ShowroomDetail(models.Model): title…
Ian Carpenter
  • 8,346
  • 6
  • 50
  • 82
1
vote
1 answer

Django Model Form Image Field Does Not Validate

I am writing a simple view using Django Model Form, however image field fails to validate with 'This field is required' error message. I wonder where the problem is... Model: class Deal(AbstractModel): IMAGE_MAX_LENGTH = 200 place =…
Dogukan Tufekci
  • 2,978
  • 3
  • 17
  • 21
1
vote
1 answer

Django admin serving uploaded image

I am new to Django I'm stuck with regards to how I can fix this issue. I have a a model which contains an ImageField as follows name = models.CharField(max_length=100) description = models.CharField(max_length=1000) file =…
1
vote
0 answers

request.FILES empty when submiting form through javascript

I am trying to sumbit a form in django that has a file on it. The form is the following and is placed in the body of a modal dialog
{%csrf_token%}…
Apostolos
  • 7,763
  • 17
  • 80
  • 150
1
vote
0 answers

Handle multiple language filename for FileField in Django models

Here a simple django model: class File(models.Model): info = models.CharField(max_length=150,null=True,blank=True) slug = models.SlugField(max_length=50, blank=True) file = models.FileField(upload_to="files") and I would like to save…
MohTaheri
  • 33
  • 4
1
vote
1 answer

django suspicious operation on image upload

In my admin I try to upload an image and after clicking save I get this error: SuspiciousOperation at /admin/the_chooser/book/add/ Attempted access to '/media/51VqHa8exoL.jpg' denied. Request Method: POST Request URL: …
smilebomb
  • 5,123
  • 8
  • 49
  • 81
1
vote
3 answers

Django : Read multiple file from html form

I am trying to upload multiple files using Django. Using following code select multiple files in html form. index.html IMAGE Files:
mridul
  • 1,986
  • 9
  • 29
  • 50
1
vote
1 answer

How to upload images to Django media without subdirectory

I need to upload an image to a Django ImageField, but due to a restriction based on a third party API, I need the images to be uploaded to the media directory without a subdirectory. The restriction is due to the fact that the filename stored…
Tom Manterfield
  • 6,515
  • 6
  • 36
  • 52
1
vote
1 answer

Django: put request.FILES in request.SESSION

I'm trying to put the request.session fields in my request.session for use it later. But when I simply write: request.session['fileInfo'] = request.FILES I always get this error: Pickilng error: Can't pickle : attribute…
Piero Alberto
  • 3,823
  • 6
  • 56
  • 108
1
vote
1 answer

Anyone know an up-to-date (September 2009) example of file-uploading in Django?

UPDATE : thanks to posters below, it's clear that the official documentation is up-to-date. Best to read that carefully rather than skim a bunch of other pages that turn up in Google. I keep finding examples and snippets for uploading files in…
interstar
  • 26,048
  • 36
  • 112
  • 180
1
vote
0 answers

Initialize Django Form FileField

I have a Django form class like; class FileDefinitionForm(ModelForm): fileContent = forms.FileField(required=False) def __init__(self, *args, **kwargs): super(FileDefinitionForm, self).__init__(*args, **kwargs) …
Ahmet DAL
  • 4,445
  • 9
  • 47
  • 71
1
vote
0 answers

django-storages s3boto backend uploaded file links are broken

I am using django-storages' s3boto backend as my default storage backend. If I upload to my publicly accessible bucket via AWS console, I have no problem accessing it. If I use my Django form to save a file, the file appears in the AWS console with…
onurmatik
  • 5,105
  • 7
  • 42
  • 67
0
votes
1 answer

RuntimeError: maximum recursion depth exceeded : why?

I created a subclass of the Django File object to take care of remote file. I also wanted to make a lazy version by creating a RemoteFileLazy subclassing the Lazyobject class but it does not work as I expected. I get an error. import urllib2 from…
Michael
  • 8,357
  • 20
  • 58
  • 86