Tôi đang sử dụng đá quý kẹp giấy để tải tệp lên. Tôi muốn tải lên các loại tệp khác nhau như pdf, doc, video và âm thanh. Tôi đã xác thực cho loại tệp trong mô hình của mình. Đối với doc, pdf và Video nó đang hoạt động nhưng nó không phải là wroking cho tập tin âm thanh. Hãy giúp tôi. Mô hình của tôiKẹp giấy Tệp âm thanh tải lên
class Xyz < ActiveRecord::Base
attr_accessible :email, :name, :avatar, :CategoryID
has_attached_file :avatar
validates_attachment_content_type :avatar, :content_type => ['video/mp4','video/avi','Audio/mp3','application/pdf',"application/pdf","application/vnd.ms-excel",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/msword",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"text/plain"]
#validates_attachment_content_type :avatar, :content_type => ['audio/mp3']
end
Đây là lỗi tôi nhận ...
1 error prohibited this xyz from being saved:
Avatar content type is invalid
Cảm ơn, Nó hoạt động hoàn hảo – pritesh