How to upload large files to Heroku (especially video)

I use heroku to host a web application with the main purpose of posting videos. Videos are hosted through vimeo pro and I use vimeo gem by matthooks to help handle the upload process. Downloading works for small files, but not for large ones (e.g. ~ 50 MB).

A look at the heroku logs shows that I am getting http error 413, which means "Request Entity Too Large". I believe that this is probably due to the limit that the hero places on the file upload (more than 30 MB, according to this web page ). The problem is that any information that I can find on this subject seems outdated and contradictory (for example, this page claims that the size of the limit does not exist ). I also could not find anything on the heroku website about this.

I searched google and found several few relevant pages ( one and two ), but no solutions that worked for me. Most of the pages I found relate to uploading large files to amazon s3, which is different from what I'm trying to do.

Here is the corresponding output of the logs:

2012-07-18T05:13:31+00:00 heroku[nginx]: 152.3.68.6 - - [18/Jul/2012:05:13:31 +0000]
  "POST /videos HTTP/1.1" 413 192 "http://neoteach.com/components/19" "Mozilla/5.0 
  (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20100101 Firefox/13.0.1" neoteach.com

There are no other errors in the logs. This is the only conclusion that appears when I try to upload too large a video. This means that this is not a timeout error or a problem with the excess of allocated memory on the dyno.

Does the hero really limit the size of unloading? If so, is there a way to change this limit? Please note that the files themselves are not stored on heroku servers at all, they are simply transferred to vimeo servers.

, - , ?

!

+5
3

Update:

OP . , 413, , s3_swf_upload . -, , ( 3 4, ), .

( !), , , - "H12 - - ". . , heroku ( -), .

, s3 .

:

  • s3_swf_upload gem s3.
  • , javascript, .
  • javascript, , , .
  • , javascript, : (a) s3_key ( ). (b) delayed_job gem.
  • s3. aws-sdk gem, , s3_swf_upload. , aws-s3 ( ).
  • , s3, vimeo gem, vimeo ( ).

, , . 500 R14 . , heroku 512 , . , - chunking , s3 vimeo . , , .

, -. - . , , , , .

+4

, , , Heroku, . , Heroku 30 - .

, S3/Vimeo/whereever, .

Ruby, , . , - , , .

+2

I think the best option here is to download directly to S3. This is much cheaper and safer than allowing users to upload files to your own server (or Heroku in this case). It is also a well-established pattern used by many hosting platforms (I know that vzaar does this).

Check out the jQuery download plugin that allows you to directly upload to S3: https://github.com/blueimp/jQuery-File-Upload

Also check out Railscasts on this topic: # 381 and # 383.

+2
source

All Articles