2016-06-18 3 views
-1

반송파로 다중 파일 업로드를 수행하고 싶습니다.반송파 여러 파일 업로드 및 저장

내가 .MP4 .MOV sveral 형식의 동영상을 변환 업로드 ...

지금은 모든 사람을 업로드하고 DB에 저장하려면?

어떻게하면 carrierwave를 사용하여 파일 버전을 저장할 수 있습니까?

감사

답변

1

모델에 관련 속성을 추가하고 before_save 콜백을 소개합니다. 자세한 내용은

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 

github

+0

나는이 너무 carrierwave 업 로더에서 할 수있는 참조하십시오? 각 요소에 대해 테이블의 특수 열을 설정해야합니까? – Felix