Rails: how does background file loading work?

Uploading a file to the REQUEST / RESPONSE loop for large files is not a pleasant experience for the user, because the application seems to freeze during file loading. More importantly, the user can interrupt the download and restart the download process again.

How can I complete the boot process in the background?

There are several examples of doing background tasks in rails on railscasts.com , but it’s not clear to me how to integrate the background job with the file upload.

In other places, I see that for this I need to configure the web server, but then I need to ask people from my shared host to get technical support on this?

+4
source share
1 answer

If you use Rails 3, check out my sample projects that let you upload directly to S3 and download work from the application. Then you can simply use the deferred task to perform secondary operations:

Sample project using Rails 3, Flash and MancyTools based on FancyUploader to download directly to S3: https://github.com/iwasrobbed/Rails3-S3-Uploader-FancyUploader

Sample project using Rails 3, Flash / Silverlight / GoogleGears / BrowserPlus and based on JQuery to download directly to S3: https://github.com/iwasrobbed/Rails3-S3-Uploader-Plupload

By the way, you can do post-processing with Paperclip and delayed_job using something like this blog post:

http://www.railstoolkit.com/posts/fancyupload-amazon-s3-uploader-with-paperclip

+4
source

Source: https://habr.com/ru/post/1308241/


All Articles