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

iOS: Only small size photo is uploaded to the server using HTTPClient.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: None
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: iOS
    • Environment:
    • Story Points:
      0
    • Sprint:
      2018 Sprint 15 SDK

      Description

      Description

      The photo is not uploaded to the server if the data size is bit high. I have attached four photos, among them only first photo(37k) is uploaded to the server and rest of the photo call onerror function. But on android, all the photo is uploaded successfully.

      Steps to Reproduce

      1. Create a new App
      2. Run the following code to the device

      app.js

       
       
          var win = Ti.UI.createWindow({
              backgroundColor: 'Green',
              layout: "vertical"
       
          });
       
       
          // Create a Button.
          var Gallery = Ti.UI.createButton({
              title: 'Opne Gallery',
              height: Ti.UI.SIZE,
              width: Ti.UI.SIZE,
              top: 50,
       
          });
       
          win.add(Gallery);
       
          var ind = Titanium.UI.createProgressBar({
              width: 200,
              height: 50,
              min: 0,
              max: 1,
              value: 0,
              // style: Titanium.UI.ios.ProgressBarStyle.PLAIN,
              top: 20,
              message: 'Uploading image',
              font: { fontSize: 12, fontWeight: 'bold' },
              color: '#888'
          });
       
          win.add(ind);
       
       
          Gallery.addEventListener('click', function(e) {
       
              Titanium.Media.openPhotoGallery({
                  success: function(event) {
                      //upload(event);
                      ind.show();
                      var xhr = Titanium.Network.createHTTPClient();
                      xhr.onload = function(e) {
                          Ti.UI.createAlertDialog({
                              title: 'Success',
                              message: 'status code ' + this.status
                          }).show();
                      };
       
                      xhr.onerror = function(e) {
                          Ti.API.info('post,E.ERROR:' + e.error);
                          alert('post,E.ERROR:' + e.error);
                      };
                      xhr.onsendstream = function(e) {
                          ind.value = e.progress;
                          Ti.API.info('ONSENDSTREAM - PROGRESS: ' + e.progress);
       
                      };
       
                      xhr.open("POST", "https://mobile.cycu.edu.tw/api/sos/panic/");
       
                      xhr.send({
                          "app_id": '3',
                          "app_token": 'BEDF0C6702',
                          "access_id": '181',
                          "access_token": '181',
                          "coord": '',
                          "file": event.media
                      });
       
       
                  },
                  cancel: function() {
                      // called when user cancels taking a picture
                      // alert("cancel");
                  },
                  error: function(error) {
                      // called when there's an error
                      alert("error: " + error);
                  },
                  saveToPhotoGallery: false,
                  animated: true,
                  //overlay: true,
                  // allowEditing and mediaTypes are iOS-only settings
                  // allowEditing : false,
                  mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO] // Ti.Media.MEDIA_TYPE_VIDEO,
              });
       
          });
       
      win.open();
      

      Thanks

        Attachments

        1. 37K.png
          37K.png
          35 kB
        2. 4.2M.png
          4.2M.png
          4.04 MB
        3. 577K.png
          577K.png
          565 kB
        4. 8.4M.png
          8.4M.png
          8.03 MB

          Issue Links

            Activity

              People

              • Assignee:
                hknoechel Hans Knöchel
                Reporter:
                morahman Motiur Rahman
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code