sergserg
sergserg

Reputation: 22264

How to handle large file processing on a Heroku application?

I have a simple Rails app hosted on Heroku.

I' trying to upload a 50MB file and Heroku shuts down the request after 30 seconds - as expected from reading their Docs.

How do I handle this situation?

I was thinking of creating a PHP file on my dedicated server and perform an AJAX request with the file to that PHP file and return a string URL to the file asset. Then in Rails when submitting the form, I would use that file path to the dedicated server.

Upvotes: 2

Views: 712

Answers (1)

friism
friism

Reputation: 19279

You should have the user upload the file directly from the browser to AWS S3 or similar service. Here's a blog post on how to configure this. This means that the file will not have to travel through Heroku. It has the added benefit of making the file immediately available to all dynos if you've scaled your app to multiple dynos (versus being available on just the dyno that accepted the upload).

Upvotes: 2

Related Questions