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

upload.rb 555B

12345678910111213141516171819202122232425262728
  1. class Upload < ActiveRecord::Base
  2. mount_uploader :file, FileUploader
  3. process_in_background :file
  4. store_in_background :file
  5. def get_extension
  6. if(self.file_processing == false)
  7. case self.file.file.content_type
  8. when 'image/jpeg'
  9. return 'jpg'
  10. when 'image/png'
  11. return 'png'
  12. when 'image/gif'
  13. return 'gif'
  14. when 'application/pdf'
  15. return 'pdf'
  16. else
  17. return 'none'
  18. end
  19. else
  20. return 'none'
  21. end
  22. end
  23. end