Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Why is that so long to send a picture through Titanium.Network.createHTTPClient()?

$
0
0

I've Wifi connexion, I don't understand.

Titanium.Media.showCamera({
    success:function(event) {
        Ti.API.debug('Our type was: '+event.mediaType);
        if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
            var xhr = Titanium.Network.createHTTPClient();
            xhr.onload = function(e) {
                alert(e);
            };
            xhr.open('POST','https://mysite.tld/upload.php');
            xhr.send({
                fileToUpload:event.media.imageAsResized(event.media.width/2,event.media.height/2)
              });
            var snapshot = Alloy.createController('snapshot', {image: event.media}).getView();
            $.myView.add(snapshot);
        } else {
            alert("got the wrong type back  ="+event.mediaType);
        }
    },
    cancel:function() {
        alert("Cancel");
    },
    error:function(error) {
        alert(error.code);
    },
    saveToPhotoGallery:true,
    allowEditing:true,
    mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO]
});

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>