Force Response to Download File(s) to Desktop with Ruby?

Posted by viatropos on Stack Overflow See other posts from Stack Overflow or by viatropos
Published on 2010-04-05T06:29:33Z Indexed on 2010/04/05 6:43 UTC
Read the original article Hit count: 200

Filed under:
|
|
|

I was thinking about making a little crop/resize batch processor online, and wanted to know if there was a way for me to do the following:

  • upload image and specify dimensions
  • click "process" and remote app resizes image
  • image downloads automatically locally to wherever it was I uploaded it (say from my desktop), but with a new name (based on the time for example).

This would make it so I could host a free image processor that never stored any data other than tempfiles.

Is that possible? Something like Rails' send_file method, but I'm using Sinatra and am looking for something in pure ruby. What's the basic concept behind this?

What if I wanted to do this for multiple files? Ă…ssuming I can get multiple files uploaded no problem, how can I download all of them automatically?

© Stack Overflow or respective owner

Related posts about file-transfer

Related posts about ruby