I want to do a multiple file upload with carrierwave.
When I upload I transcode a movie in sveral formats .mp4 .mov ...
Now I want to upload all those and store them in DB?
how can I save versions of a file with carrierwave?
thanks
Add the relevant attributes to your model and introduce a before_save callback.
class Video < ActiveRecord::Base
mount_uploader :video, VideoUploader
before_save :update_video_attributes
private
def update_video_attributes
if video.present? && video_changed?
self.content_type = video.file.content_type
self.file_size = video.file.size
end
end
end
For more details see github
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.