Saturday, March 10, 2012

Uploading Large Files via Ajax

Hi!

I have some troubles uploading large files via ajax and would be very
happy if someone could help.

I use ajax to upload files to my django app via XHR - not Multipart
Forms.

When using this technique, django seems to not use the default
FileUpload Handlers, so I do not have something like request.FILES in
my view. Instead there is a request.raw_post_data containing the file
contents.

Now, as soon as I try to access the file content (access
request.raw_post_data), django loads the whole blob into memory. While
this might be okay to handle small files, I want to be able to upload
large video files.

I guess the best would be to use the existing django UploadHandler
framework, so small files are automatically loaded into memory and
large files to the disk. Also I would have access to the request.FILES
object.

However, I was not able to find a way to use django's UploadHandlers
without sending the files via Multipart Form.

Does anybody know how this can be achieved?

Thanks in advance / F

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate