I'm am trying to build an application that handles several types of
uploads. Currently, it will work fine for .txt type files, but for
all other kinds of files, the file is truncated to about 3 KB.
I have determined that the file gets truncated during the request. I
have included some sample code with comments to make it clear where
the file gets truncated.
def testFormRequest(self):
file = open('F:\\Sample Upload Files\\large_pdf.pdf')
# I have checked the size of 'file' here and it is the correct
size.
response = self.client.post(
'/some/url/',
{'document_id': '1',
'document_status_field': '2',
'document_version_date_field': '2008-12-12',
'document_version_number_field': '3.1',
'file': file}
)
urlpatterns = patterns('',
(r'^study/(?P<slug>[-\w]+)/grid/file/upload/$', grid_file_upload),
)
@login_required
def grid_file_upload(request, slug):
# File is truncated by the time it gets to this view.
if request.method == 'POST':
# handle the file
Am I missing something fundamental? If I change the extension of
the .txt file, it still works fine. If I change the extension of a
non-text file to .txt, it will not work.
Any help is greatly appreciated.
Kind regards,
Robert
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---