Force Response to Download File(s) to Desktop with Ruby?
- by viatropos
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?