django-imagekit icon indicating copy to clipboard operation
django-imagekit copied to clipboard

Problem with multipart upload to S3 with django-storages

Open flavianmissi opened this issue 9 years ago • 3 comments

Hi,

I've been having issues uploading larger files into my application and started reading django-storages source code to validate if it was using the multipart upload capability of S3, and it does indeed use it. The multipart handling is done by subclassing django.core.files.base.File and overriding some internal methods, like _open, as you can see yourself in more details on their source code.

I also saw that imagekit's BaseIKFile also inherits from django.core.files.base.File, and is used internally by imagekit.

As I am no expert in neither of the two projects, I was wondering if this internal usage of a custom File in both projects could be the reason why multipart upload doesn't work for me.

If it helps, here are some relevant versions:

Django==1.4
django-storages==1.1.8
django-imagekit==3.2.6

Thanks!

flavianmissi avatar Apr 25 '15 18:04 flavianmissi

It's possible, but it's hard for me to tell. What kind of issues are you having? Are you seeing errors or is it failing silently?

matthewwithanm avatar Apr 28 '15 15:04 matthewwithanm

Hi @matthewwithanm, thanks for getting back to me!

It was actually failing silently, I'm using Heroku so the situation gets even worse as Heroku's router doesn't logs anything when a request timeouts.

For future reference, I had to move all my image uploads to S3 into the frontend (using filepicker).

I implemented a custom image spec so imagekit could work with filepicker's FPUrlField (any url field actually).

You can close this issue :)

BTW, do you have interest in merging a spec that works with url fields instead of image fields? My image uploads are now flying high with that change and I'd recommend it to anyone using S3 or any other object storage service. If you agree I can extract it from my application and send a PR.

Thanks!

flavianmissi avatar Apr 28 '15 22:04 flavianmissi

Hm, I'm honestly not sure. What are the situations where you would use a URL field instead of an image field? Normally I think of the access as being abstracted away behind a storage backend.

matthewwithanm avatar May 04 '15 15:05 matthewwithanm