user1470511
user1470511

Reputation: 349

Heroku and background uploading in ruby

Currently I have an application that is uploading images to S3 in a background (Sidekiq) task. It works fine, however I have had to "hack" together a solution and was curious of anyone knew of a better way to do this.

Problem: When using Paperclip and a background job on Heroku, the worker is most often times not able to access the tmp file because it is spun up on a different server. I have tried to have paperclip use the tmp folder on Heroku, and it stores it there, however the background tasks have always returned a "File not found".

Temp solution: This results in having to encode the image to a base64 string and pass that into the perform task (disgusting, bad, horrible, large overhead).

Is there a better way to do this on Heroku? I don't want to save an image blob into the database, as that is just as bad of a practice.

Upvotes: 2

Views: 364

Answers (1)

Jakob W
Jakob W

Reputation: 3377

Would it be possible to use the Direct upload approach in the Heroku S3 guide? And then have some background job to resize or process if needed?

Upvotes: 1

Related Questions