Reputation: 8062
I have a Rails 4.1.1 app with file upload thru Paperclip to Amazon S3. I'd like to do some processing to my file when it's uploaded, and so I'd like to perform this processing before the file actually is sent to S3, so that everything happens faster, otherwise I'd have to upload the file, then download it, then process it.
So, how can I create a file, somewhere in my tmp/
folder for processing, from the form submitted by the user?
Any help would be appreciated, I could find no reference on the web for such a need.
Thanks in advance
Upvotes: 1
Views: 304
Reputation: 3407
Images are uploaded to your application before being stored in S3. This allows your models to perform validations and other processing before being sent to S3.
So I would go with Paperclip::Processor (a custom one) or Paperclip callbacks like before_post_process (usually for validation stuff).
I think this and this articles are very enlightening.
Upvotes: 4