Questions tagged [filefield]
299 questions
2
votes
1 answer
Django form FileField can't pass a validation
I see a lot of similar questions but can't found any answer. I need just to simply upload or process file using Django FileField. Here is what I have:
forms.py
class UploadForm(forms.Form):
packet_file = forms.FileField()
base.html
2
votes
1 answer
Preview ImageField after "Choose File" button was selected
So I have a really basic form with an ImageField implemented
# form
class MyForm(forms.Form):
my_image = forms.ImageField(required=False)
# Model
class MyModel(models.Model):
my_image = models.ImageField(upload_to="images",…

Pompeyo
- 1,459
- 3
- 18
- 42
2
votes
1 answer
How to update ImageField/ FileField using djangorestframework?
I want to update a model using djangorestframework. I don't need to update all fields, so I use PATCH. However, in my form I also have an image field (called 'logo'), which is required for my model. When I try to 'patch' the object and I don't…

AdelaN
- 3,366
- 2
- 25
- 45
2
votes
1 answer
Accept Image in Filefield ExtJs
I have a filefield componente in my application and I want to restrict it to only image files. I've found this question on stackoverflow:
How to restrict file type using xtype filefield(extjs 4.1.0)?
Add accept="image/*" attribute to input field in…

Alavaros
- 1,665
- 7
- 32
- 52
2
votes
1 answer
Django: Calling save() on FileField using field name as string
I am new to Django and already have read and tried everything that came into my mind.
I have a Model-based Form. The model includes 3 FileField fields:
img_big = models.FileField(upload_to='images/%Y/%m/b',max_length=100)
img_med =…

horbor
- 609
- 7
- 13
2
votes
1 answer
Linking Files to urls on django
I'm new in django and i'm building a site testing the FileField
For now I can upload the files, search, and get the url of files but when i do click in the weblink it returns 'Page not found (404)'
My code is:
In views.py:
from django.shortcuts…

Yábir Garcia
- 329
- 3
- 17
2
votes
1 answer
Easiest way to display uploaded (image)file?
I'm trying to my first attempt at django file-uploading,
and all i need at the moment is a way to display an uploaded image (png/jpg) to the user that uploaded.
No need to save it anywhere.
My views.py:
(i'm using django forms, btw)
if…

BSG
- 1,382
- 4
- 14
- 25
2
votes
0 answers
How to click on a file field button implemented in ExtJS using Selenium?
I an testing an application implemented in ExtJs.
I need to click on a button implemented as a filefield to upload a file.
I am not able to click on the button using Selenium IDE.
Infact I have tried the same on similar buttons(that have been…

user1710861
- 413
- 6
- 9
1
vote
0 answers
How to change django FileFiled 'storage' AFTER uploading?
I am developing two web sites using the Django framework.
The thing is - one site is sharing part of the content from the other one.
They both use different amazon WS buckets to store images, etc.
So for the site which shares some content with…

YemSalat
- 19,986
- 13
- 44
- 51
1
vote
1 answer
Migrate a legacy DB to Django, with image files
I have a SQL dump of a legacy DB, and a folder with images, and those are referenced by some rows of certain tables, and I need to migrate that data to the new Django models. The specific problem is how to "perform" the upload, but in a management…

Armando Pérez Marqués
- 5,661
- 4
- 28
- 45
1
vote
3 answers
Django admin filefield 404 on download
i have problems with my django app. Since a few days i have the problem that the download dont work on production but i cant find the reason why...
I can upload files and they are stored in the correct folder, but as soon as i click on it i get a…

Simon Fritz
- 11
- 2
1
vote
2 answers
Is it possible to change the status of filefield in admin - DJANGO
I'm new with django and I was wondering if it is possible to change the status Currently(see the pic) of a filefield to other things like maybe: all, list...
Because currently only return the last uploaded item. I have uploaded 5 file(File1, FIle2,…

yanned
- 13
- 3
1
vote
1 answer
Django validate FileField with clean()
I have a Form that includes a FileField and a CharField. Both work as expected.
Neither field is required by itself, but one of them has to be given. So I want to add a validation that fails if both are empty.
in forms.py:
class MyForm(forms.Form):
…

CodingCat
- 4,999
- 10
- 37
- 59
1
vote
2 answers
Delete Django ImageField and FileField records whose files are not found on the server
I've recently lost some files in my media folder, and I want to delete the image field/FileField objects whose files have been removed, across all models of my application.
I've tried django-cleanup, but it appears to be doing the inverse operation,…

wilcoln
- 63
- 1
- 7
1
vote
1 answer
Writing a ruby file_field in html
<%= f.file_field :photo %>
How do I write this in html? I know that it's an input type="file" but how can I put in the :photo? I need to customise the field by writing it in html in rails.

user852974
- 2,242
- 10
- 41
- 65