John Bowlinger John Bowlinger - 1 year ago 76
iOS Question

accessing ext from UIImagePickerControllerReferenceURL

How do I access just the MIME ext part of UIImagePickerControllerReferenceURL? This is what I get when I NSLog -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

UIImagePickerControllerReferenceURL = "assets-library://asset/asset.PNG?id=F61B754A-705C-4BFB-9965-DE34C7B93A2B&ext=PNG";

I just want access to the MIME type. When I send an image to my webserver using:

NSData *imageData = UIImageJPEGRepresentation(_selectedImage, 1.0);

//non-important ASIFormDataRequest set-up
[request setData:imageData withFileName:uniqueString andContentType:@"image/jpeg" forKey:@"photo"];

The picture comes in all messed up. But when I use :

NSData *imageData = UIImagePNGRepresentation(_selectedImage);

//non-important ASIFormDataRequest set-up
[request setData:imageData withFileName:uniqueString andContentType:@"image/png" forKey:@"photo"];

The picture comes in fine. But all my uploaded photos won't be PNG though.

Answer Source

Dimitris's answer on this thread worked like a charm. I am going to keep typing now so this doesn't get relegated to a trivial answer, and then automatically made into a comment.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download