Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-7264

Android: HTTPClient not working for upload files (Parity)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 1.8.0.1, Release 2.0.0
    • Component/s: Android
    • Environment:

      Titanium SDK version: 1.8.0.1
      Javascript Engine: Rhino / V8
      Platform & version: Android 2.3
      Device Details: Android emulator
      Host Operating System: OSX Lion
      Titanium Studio version: 1.0.7

      Description

      PROBLEM DESCRIPTION

      Customer can't upload files thru HTTPClient from Android. Code is working perfect in iOS.

      STEPS TO REPRODUCE

      1. Create mobile project
      2. Paste this code to app.js

      var win = Ti.UI.createWindow();
       
      var image = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'appc.jpg');
      	
      var xhr = Titanium.Network.createHTTPClient();
       
      xhr.onerror = function(e)
      {
      	Ti.UI.createAlertDialog({title:'Error', message:e.error}).show();
      	Ti.API.info('IN ERROR ' + e.error);
      };
      xhr.setTimeout(20000);
      xhr.onload = function(e)
      {
      	Ti.UI.createAlertDialog({title:'Success', message:'status code ' + this.status}).show();
      	Ti.API.info('IN ONLOAD ' + this.status + ' readyState ' + this.readyState);
      };
      xhr.onsendstream = function(e)
      {
      	Ti.API.info('ONSENDSTREAM - PROGRESS: ' + e.progress);
      };
       
      // open the client
      xhr.open('POST','https://twitpic.com/api/uploadAndPost');
       
      // send the data
      xhr.send({media:image,username:'fgsandford1000',password:'sanford1000',message:'check me out'});
       
      win.open();
      

      3. Run this on Android

      ACTUAL RESULTS

      The upload is not working

      EXPECTED RESULTS

      The upload working fine, as in iOS. 

        Attachments

          Activity

            People

            • Assignee:
              billdawson Bill Dawson
              Reporter:
              mpmiranda Mauro Parra-Miranda
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-11792
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration