问题
I am using paperclip gem for uploading. And i want to save the uploaded file/image outside of the public folder. If you have any idea please share.
回答1:
Actually there is many. The 'public' option is just to be able to test easily. For your production server, paperclip gives three options:
- File Storage
- S3 Storage (via aws-sdk)
- Fog Storage
File storage can be configured to go to any folder you want with something like:
config.paperclip_defaults = {
:path => "/yourfolder/:basename.:extension"
}
This can be overridden on the class itself if needed:
has_attached_file :avatar,
:path => "/yourotherfolder/:basename.:extension"
来源:https://stackoverflow.com/questions/23950986/rails-paperclip-is-there-any-option-to-save-the-uploaded-file-outside-of-the-p