Guest User

Untitled

a guest
Apr 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. private static String contentType(String fileName)
  2. {
  3. if (fileName.endsWith(".htm") || fileName.endsWith(".html"))
  4. {
  5. return "text/html";
  6. }
  7. if (fileName.endsWith(".jpg") || fileName.endsWith(".jpeg"))
  8. {
  9. return "image/jpeg";
  10. }
  11. if (fileName.endsWith(".gif"))
  12. {
  13. return "image/gif";
  14. }
  15. if (fileName.endsWith(".txt"))
  16. {
  17. return "text/plain";
  18. }
  19. if (fileName.endsWith(".pdf"))
  20. {
  21. return "application/pdf";
  22. }
  23. return "application/octet-stream";
  24. }
Add Comment
Please, Sign In to add comment