1

私はチタン スタジオを使用しており、POST リクエストから画像を保存しようとしています。

 function buyImage(s){


var userName = Ti.App.Properties.getString('username');
    var email = Ti.App.Properties.getString('email');
    var encKey = Ti.App.Properties.getString('key');



var client = Ti.Network.createHTTPClient({

    // function called when the response data is available
    onload : function(e) {
        Ti.API.info("Key Text: " + this.responseData);


        Titanium.Media.saveToPhotoGallery(this.responseData,{
    success: function(e) {
        Titanium.UI.createAlertDialog({
            title:'Photo Gallery',
            message:'Check your photo gallery for you image'
        }).show();      
    },
    error: function(e) {
        Titanium.UI.createAlertDialog({
            title:'Error saving',
            message:e.error
        }).show();  
    }


});


        Titanium.UI.createAlertDialog({title:'Photo Gallery',message:'Photo saved to gallery'}).show();     

    },
    onerror : function(e) {
        Ti.API.info(e.error);
        alert('error');
    },
    timeout : 5000 // in milliseconds
});
// Prepare the connection.
client.open("POST", "http://somesite/create/save?userName="+userName+"&encryptionKey="+encKey+"&email="+email+"&recordId="+s);
// Send the request.        
client.send();

画像は正常に保存され、応答データは TiBlob であると表示されていますが、画像はまったく保存されていないようです。ブラウザーの投稿イベントで同じ投稿が行われると、画像をダウンロードするように求められます。

何か案は?

4

0 に答える 0