Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#9184 closed (invalid)

'str' object has no attribute 'chunks'

Reported by: Deepak <deep.thukral@…> Owned by: nobody
Component: Core (Other) Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Uploading file to FileField causes AttributeError. I used

my_object.my_field.save(somename, content, save=False) 

Here content is a string from

request.FILES['filedata'].read()

Attachments (2)

storage_save_str_fix.diff (743 bytes ) - added by Deepak <deep.thukral@…> 16 years ago.
patch - attrib check on content
storage_save_str_fix2.diff (832 bytes ) - added by Deepak <deep.thukral@…> 16 years ago.
Correct version

Download all attachments as: .zip

Change History (4)

by Deepak <deep.thukral@…>, 16 years ago

Attachment: storage_save_str_fix.diff added

patch - attrib check on content

by Deepak <deep.thukral@…>, 16 years ago

Attachment: storage_save_str_fix2.diff added

Correct version

comment:1 by Bob Thomas, 16 years ago

Resolution: invalid
Status: newclosed

According to the documentation: http://docs.djangoproject.com/en/dev/ref/files/file/#django.core.files.File.save

The content argument is supposed to be a subclass of File, such as UploadFile. Just use request.FILESfiledata for content instead of request.FILESfiledata.read()

in reply to:  1 comment:2 by Bob Thomas, 16 years ago

Oops, bad formatting. I meant

request.FILES['filedata']

of course.

Note: See TracTickets for help on using tickets.
Back to Top