Questions tagged [filefield]

299 questions
4
votes
1 answer

File upload field is reset when submit form

I am using ExtJS version 4.1.1. I try to create upload file form using filefield as follow: { xtype: 'filefield', itemId : 'my-file', name: 'my file', emptyText : 'No file chosen', fieldLabel: 'Upload File', submitValue:…
Gui
  • 51
  • 4
  • 7
4
votes
2 answers

Drupal 7: Rename files on upload (via filefield)

I am looking for a way to rename files that are uploaded by users through a filefield. For example, rename user profile photos using uniqid. I found a good solution for D6 at "Drupal 6: How to Change Filename on Upload" but can't find anything for…
Eugene
  • 41
  • 1
  • 3
4
votes
2 answers

django accessing uploaded files in model custom save, best practice?

Ive recently been experiementing with using django I want to be able to run an uploaded file through imagemagick on the model save function, I realised this wasn't possible due to the file not being available till the instance had been saved I've…
3
votes
1 answer

django makemigrations raise error after remove a function in models.py

I define a model named Foo which has a FileField named bar, and I define a function baz which is callable used for bar's upload_to arguement in same file. When I removed the bar field and baz funcion and perform makemigrations operations, it raise…
2v Cheng
  • 31
  • 3
3
votes
1 answer

Flask-WTForm FileField returns None instead of the file uploaded

I am trying to upload a picture using Flask-WTForm's FileField. But even though I upload a picture, it can't detect it. The form is created as: class User_settings_profile_picture_form(FlaskForm): picture = FileField('Update profile picture',…
ishmamt
  • 177
  • 9
3
votes
1 answer

Django Create file in MEDIA_ROOT folder and save it to FileField

Currently I want to create a file under MEDIA_ROOT folder and save it to FileField. I searched on SO website, tried the method on django-how-to-create-a-file-and-save-it-to-a-models-filefield and other, but looks it saved absolute path on my db. My…
Kumar
  • 73
  • 7
3
votes
1 answer

How to use Django FileField with dynamic Amazon S3 bucket?

I have a Django model with a Filefield, and a default storage using Amazon S3 bucket (via the excellent django-storage). My problem is not to upload files to a dynamic folder path (as we see in many other answers). My problem is deeper and…
onekiloparsec
  • 2,013
  • 21
  • 32
3
votes
2 answers

Is it possible to query Django objects by their FileField's url attribute

I have a Django class with a FileField. I know that you can get the FileField's url, or path, by calling filefield.path, or filefield.url . I tried to query for all of those objects by their FileField's url using media =…
TJB
  • 3,706
  • 9
  • 51
  • 102
3
votes
2 answers

Rails / nested attributes / file_field doesn't show up within params when empty

I'm having two models, the first one (model_1) accepts nested attributes for the second one (model_2). The second model has only one field (file), which is referenced in the form as file field. The problem comes when no file has been selected. In…
polarblau
  • 17,649
  • 7
  • 63
  • 84
3
votes
2 answers

Django ImageField Image Not Displaying

I'm trying to use Django 2.0. I'm using the development 'runserver' right now, so please keep in mind that I'm not in production yet. I am familiar with the differences between the two with regard to static files. I have a Blog Post model. In the…
Ron Raney
  • 372
  • 2
  • 4
  • 14
3
votes
1 answer

How to insert multiple images into a blog post not File field upload (Django blog)

I am a semi-noob to Django web development. I've managed to add a File field that actually allows me to upload an image into the post (The image is displayed in post-list and post-detail) but what if I wanted to add several images in a post? I am…
Curly77
  • 33
  • 3
3
votes
1 answer

How can I replace/override an uploaded file?

I want to be able to upload a file and on each upload to override/replace the existing file with the newest version. from django.core.files.storage import FileSystemStorage fs = FileSystemStorage(location='C:/temp', base_url='/attachments') …
Seitaridis
  • 4,459
  • 9
  • 53
  • 85
3
votes
2 answers

How to upload a file in rails?

I'm new to rails. I want to know about file uploading process in rails. Can anyone please help me... Thanks, Althaf
althaf_tvm
  • 773
  • 3
  • 15
  • 28
3
votes
4 answers

Rails 4: how to apply custom CSS to Rails form file field

I have a Rails 4 app, that uses Rails' default form (I am NOT using Simple Form). One of my forms allows users to upload an image (thanks to Paperclip): <%= f.file_field :image, value: "Choose a file" %> I would like to style the…
Thibaud Clement
  • 6,607
  • 10
  • 50
  • 103
3
votes
2 answers

Django FileField: how to set default value (auto-create empty file)?

I've got a model like this: class MyModel(models.Model): name = models.CharField(max_length=255) code = models.FileField() When a new MyModel is submitted, I want to allow for the code field to be left empty, in which case I need Django to…
letoosh
  • 511
  • 2
  • 6
  • 13