A website template with lots of features, built with ruby on rails.

upload.rb 381B

123456789101112131415161718192021
  1. class Upload < ActiveRecord::Base
  2. mount_uploader :file, FileUploader
  3. def get_extension
  4. case self.file.file.content_type
  5. when 'image/jpeg'
  6. return 'jpg'
  7. when 'image/png'
  8. return 'png'
  9. when 'image/gif'
  10. return 'gif'
  11. when 'application/pdf'
  12. return 'pdf'
  13. else
  14. return 'none'
  15. end
  16. end
  17. end