Questions tagged [filefield]

299 questions
0
votes
1 answer

How to localize the label of a file_field in Rails?

I want to localize a form in my app so that all the labels are in Finnish. This is easy with all other form components, but how do I do this with a file field? It always seems to give me a label "choose file" in the button and "no file chosen"…
Kusti
  • 1,279
  • 1
  • 10
  • 18
0
votes
1 answer

Save a Django model field into a new file

In my models.py file I have a class called 'Problem', which basically stores a question, its answer and some scoring related information for that question. Here's the code for that class: class Problem(models.Model): def CreatePath(instance,…
Nishad
  • 102
  • 1
  • 3
  • 9
0
votes
3 answers

move_uploaded_file only if file selected

I would appreciate if someone could help me with this issue. The problem is that i have a page where i upload an image and it´s description, but when i update the image description and keep the filefield blank when i press submit to update the…
0
votes
1 answer

form validation fail in django with enctype="multipart/form-data"

When I use FileField in one of my three classes in one template file and make the form enctype multipart/form-data, all of three form get invalid in is_valid method. When I see form.errors all the field become invalid. When I remove enctype from…
mohsenXAD
  • 11
  • 4
0
votes
1 answer

URL for FileField

What is the most simple solution to such a problem: use models.FileField for local file or models.CharField for entering URL, depends on an option which were switched before. The next code does not work, but shows the idea: class T(models.Model): …
SWAPYAutomation
  • 693
  • 4
  • 11
0
votes
1 answer

Storing files on file-system when there are multiple server instances

I have multiple django server instances handled by a load balancer. When I need to scale up, I replicate a clone of the server machine and add the new server instance to the load balancer. I also use the admin interface in order to upload…
odedfos
  • 4,491
  • 3
  • 30
  • 42
0
votes
2 answers

How to save a file field of a new django model object to the path with ID?

In Django I use the model class Specialist(models.Model): ... photo = models.ImageField(_('photo'), upload_to='spec_foto') ... After I create and save a new object, I have the "photo" field at .../spec_photo/filename.jpg But I'd like to…
Ramil
  • 1
  • 1
  • 1
0
votes
1 answer

two same attributes in POST

I need to upload file with Yii. In view I have row: , where $qualificationModel = new SkillsMapping; Part of controller: $skillsModel = SkillsMapping::model(); …
f0rtis
  • 326
  • 2
  • 13
0
votes
1 answer

Django ClearableFileInput widget doesn't set FileField to None

My Django app is saving articles and includes a upload file field that uses the ClearableFileInput widget When I set an article to publish, that's calling a task to send emails. It seems to work, but there is a bug. When I edit an existing…
Anthony Roberts
  • 1,971
  • 1
  • 19
  • 34
0
votes
1 answer

Suspiciousoperation error when trying to read the default value of a django filefield

I need to set up a model with a FileField in django, but, if the user doesn't give a value, i should set a default. However, my model definition is the following class AutoAttendant(models.Model): name = models.CharField(max_length=32) …
iferminm
  • 2,019
  • 19
  • 34
0
votes
1 answer

How to save a local file in a FileField in django

I need to get a file through a SOAP Web Service and save it into a model using django's FileField. I've done the following: In my SOAP Wrapper, I save the file in a temp directory # ... get the file and file_name and decode put it into a variable…
iferminm
  • 2,019
  • 19
  • 34
0
votes
1 answer

type error while creating a django model having a file-field

Getting the following error while trying to create(&save) a django model with file field : TypeError at /admin/app_name/template/add/ coercing to Unicode: need string or buffer, int found Request Method: POST Request URL: …
apratimankur
  • 783
  • 1
  • 5
  • 10
0
votes
1 answer

Extjs File Upload with C#

I know how the xtype: filefield works and I also realized that file upload does not use the regular ajax method to read and write data to database... I can set up filefield normally and when I click the browse button I can select the necessary file.…
EagleFox
  • 1,367
  • 10
  • 34
  • 58
0
votes
1 answer

How to get filesystem path from mongoengine FileField

I need to obtain path from a FileField, in order to check it against a given file system path, to know if the file I am inserting into mongo database is already present. Is it possible? All I get is a GridFSProxy, but I am unable to understand how…
gc5
  • 9,468
  • 24
  • 90
  • 151
0
votes
1 answer

How to save via mongodb shell a file served by GridFS in a mongoengine/Django FileField

I have a file saved on GridFS, via mongofiles $ mongofiles -d dba put file.txt connected to: 127.0.0.1 added file: { _id: ObjectId('50c0a48f8d1d53325a7d7b01'), filename: "file.txt", chunkSize: 262144, uploadDate: new Date(1354802319244), md5:…
gc5
  • 9,468
  • 24
  • 90
  • 151
1 2 3
19
20