0

I'm translating some code from Android to iOS. To be more specific, I'm converting a multipart Http Post.

In Android there's a static method guessContentTypeFromName for the class URLConnection that returns the correct MIME-type from a given filename as input. The result is used as value for "Content-Type" parameter of the request.

You can read documentation about this method here: http://developer.android.com/reference/java/net/URLConnection.html#guessContentTypeFromName(java.lang.String)

I read the source of this method and, roughly speaking, there's a java map that contains Mime-Type/file extension association to extract Mime-type from filename extension.

As my knowledge, there's not such equivalent in the Cocoa Touch framework, so I'm asking how can I implement something similar. Of course if something similar exists, I need to be addressed to the right point.

Thank you in advance

giampaolo
  • 6,906
  • 5
  • 45
  • 73
  • Here's an example implementation: http://stackoverflow.com/questions/2439020/wheres-the-iphone-mime-type-database – Tomek Kopczuk Jul 17 '12 at 21:56
  • Ok, i'm giving it a try, but why you put that link as comment and not as answer? – giampaolo Jul 17 '12 at 22:15
  • To be honest - I did not have time to put together a nice, complete answer, but I figured you might use a hint sooner rather than later - as it often happens in our trade. Hope it works! – Tomek Kopczuk Jul 17 '12 at 23:35

0 Answers0