Carl
Carl

Reputation: 2934

Can I get a mime type using iOS UIDocumentPickerViewController?

I'm importing a file on iOS

When this delegate is called...

func documentPicker(controller:UIDocumentPickerViewController, didPickDocumentAtURL url:NSURL)

can I retrieve the mime type of the file? I need it to place in an email so that mail clients can open the attachment correctly?

Upvotes: 1

Views: 1958

Answers (1)

Carl
Carl

Reputation: 2934

iOS doesn't provide content type via its documentPicker UI.

however, one can use the filename extension.

e.g., Mandrill: if user picks a file called "example.pdf"

encodedFileContent = ...

attachments:
[{
    type: "application/pdf",
    name: "example.pdf",
    content: encodedFileContent
}]

Upvotes: 2

Related Questions