0

I'm developing an app where people can download files, and have no problem downloading and saving them. The problem is, when some files are downloaded, they have no file extension (http://test.com/test, instead of http://test.com/test.zip), and I can't determine what kind of file they are. I've tried using NSHTTPURLResponse's suggestedFilename property, but that still doesn't put an extension on the file. So my question is, how do I know what kind of file something is without an extension? I've also tried getting the mime type of the file, but that didn't work.

Community
  • 1
  • 1
Chris Loonam
  • 5,735
  • 6
  • 41
  • 63
  • 1
    Assuming you are downloading the file using `NSURLConnection`, have you tried getting the file's mime type from the response's `MIMType`? – rmaddy Apr 19 '13 at 03:15
  • 1
    What didn't work about getting the MIME type? That's how browsers do it, regardless of the file extension. Edit: actually, here's the iOS way: http://stackoverflow.com/questions/9801106/how-can-i-get-mime-type-in-ios-which-is-not-based-on-extension Second edit: never mind, that just uses the file extension. Stick to MIME type :) – Turch Apr 19 '13 at 04:04

0 Answers0