Rajat
Rajat

Reputation: 1388

Ruby on rails timeout during large uploads

I am trying to upload my files on aws s3 using ruby on rails. Code is working great for smaller upload but for uploads greater than 3-4mb, i get timeout error. I am uploading files on s3 using code:

AWS::S3::S3Object.store(filename, params[:file].read, @BUCKET_NAME, :access => :private)

How can i resolve my issue for larger uploads. Can i increase the timeout interval time for ruby scripts for allowing larger uploads?

Please help...

Upvotes: 2

Views: 1145

Answers (3)

pjam
pjam

Reputation: 6356

I would suggest taking advantage of the recent CORS support. I tried to detail clearly how to use it there : http://pjambet.github.com/blog/direct-upload-to-s3/

Upvotes: 2

uday
uday

Reputation: 8710

Assuming you are using: aws-s3 gem

When you are dealing with large files you have to use I/O stream, so that file is read in segments.

Instead you might use something like this:

S3Object.store('roots.mpeg', open('roots.mpeg'), @BUCKET_NAME, :access => :private)

More details can be found: http://amazon.rubyforge.org/

Upvotes: 0

Anshu
Anshu

Reputation: 7853

I would suggest you to use http streaming for long request

Upvotes: 0

Related Questions