zallarak
zallarak

Reputation: 5515

Troubleshooting s3 ajax uploader in Django

I'm using: https://github.com/GoodCloud/django-ajax-uploader with AWS backend (s3 boto). My file uploads are all 0 bytes, but they upload and the correct filename shows up on the correct bucket. Any thoughts on why the files are all 0 bytes though? I am looking for some higher level considerations.

Here's s3 backend code: https://github.com/GoodCloud/django-ajax-uploader/blob/master/ajaxuploader/backends/s3.py

Upvotes: 0

Views: 453

Answers (3)

garnaat
garnaat

Reputation: 45856

The s3 backend for this Ajax uploader is using MultiPart upload. This will only work for files that are > 100MB and each part must be 5MB or larger. So, I think what is happening is that it's initiating the Multipart upload and finalizing it but the individual parts are being rejected because they are too small. So, the result is a zero-length file in S3.

Upvotes: 2

Sean Conaty
Sean Conaty

Reputation: 86

I just encountered something like this. Try calling the method seek(0) on the file to set its current position back to the beginning.

Upvotes: 2

I believe that if you write to StringIO like that, it positions the file pointer at the end, and there is nothing to upload. You ought to do

buffer = StringIO(chunk)

Upvotes: 2

Related Questions