Repro sequence
Ti.Media.openPhotoGallery({
success : function(event) {
var alertText = '';
var image = event.media;
alertText += image.mimeType + '\n';
alertText += image.imageAsThumbnail(200).mimeType + '\n';
var imageView = Ti.UI.createImageView({
image : image
});
alertText += imageView.toBlob().mimeType + '\n';
alert(alertText);
//exam request multipart 'image' property. It has a txt.filename (tixhr-xxxxxx.txt), why txt?;
var xhr = Ti.Network.createHTTPClient();
xhr.open("POST", 'http://www.google.com');
xhr.setRequestHeader("enctype", "multipart/form-data;");
xhr.send({
image : imageView.toBlob()
});
},
mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO]
});
iOS Alert result:
image/jpeg
image/jpeg
image/jpeg
Android alert result:
image/jpeg
image/bitmap
image/bitmap
Additional info
Attached request multipart screenshots
What is your Android OS device/emulator version?
tested only devices. Galaxy 3(SH-E210S, Android 4.0.4) Galaxy Nexus (Android 4.1.1.)
This is still an issue in 3.2.1.GA
The problem is also present in 3.4.0.GA. In my case even when the file is a JPEG, XHR its sending it as BMP (Tested in Motorola Moto G XT1032). My only workaround its just add the bmp extension even when its JPEG and let the browser guess the right mime-type then but its clearly not a good solution.
Also got this problem. Working with SDK 6.0.2, tried multiple simulators, same issue.