Ich benutze Paperclip Gem, um Dateien hochzuladen. Ich möchte verschiedene Arten von Dateien wie PDF, Doc, Video und Audio hochladen. Ich habe eine Validierung für den Dateityp in meinem Modell. Für Doc, PDF und Video funktioniert es, aber es wird nicht nach Audiodateien gesucht. bitte hilfe. Mein ModellPaperclip Audiodatei-Upload
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
Dies ist der Fehler, den ich bekam ...
1 error prohibited this xyz from being saved:
Avatar content type is invalid
Dank hinzufügen, Es hat perfekt funktioniert – pritesh