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

Windows: Add support for file property to HTTPClient

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: Release 7.5.0, Release 7.4.1
    • Fix Version/s: Release 8.1.0
    • Component/s: Windows
    • Labels:
      None
    • Environment:
    • Story Points:
      5
    • Sprint:
      2018 Sprint 25, 2018 Sprint 26, 2019 Sprint 1, 2019 Sprint 3, 2019 Sprint 5

      Description

      Test case:

      function createButton(title, filename, url) {
      	var b = Ti.UI.createButton({
      		title : title
      	});
       
      	b.addEventListener("click", function() {
      		var xhr = Titanium.Network.createHTTPClient();
      		if (filename != null) {
      			xhr.file = filename;
      		}
      		xhr.onload = function() {
      			var responseFilePath = this.responseData.nativePath;
      			alert("responseData.nativePath = " + responseFilePath);
      			if (responseFilePath != null) {
      				imageView.image = responseFilePath;
      			} else {
      				imageView.image = this.responseData;
      			}
      		};
      		xhr.open('GET', url);
      		xhr.send();
      	});
      	
      	return b;
      }
       
       
      var win = Titanium.UI.createWindow({
      	title: "The 'file' property for HTTPClient",
      	layout: "vertical"
      });
       
      var imageView = Titanium.UI.createImageView({
      	top : 5,
      	height : 200,
      	width : 300
      });
       
      win.add(createButton("Not setting 'file' (download a small image)", null, "http://developer.appcelerator.com/blog/wp-content/themes/newapp/images/appcelerator_avatar.png?s=48"));
      win.add(createButton("Not setting 'file' (download a large image)", null, "http://2.bp.blogspot.com/-z-cZ7JirojQ/Tc8OMAAqbLI/AAAAAAAAAfc/slhGE764cyY/s1600/Cars+2.jpg"));
      win.add(createButton("'file' is in tempDirectory", Ti.Filesystem.tempDirectory + "/sky.jpg", "http://www.forestwander.com/wp-content/original/2009_01/Sky-View.JPG"));
      win.add(createButton("'file' is in applicationDataDirectory", Ti.Filesystem.applicationDataDirectory + "/flower.jpg", "http://flowerdeliverygo.com/wp-content/uploads/2014/05/flower-delivery.jpg"));
      win.add(createButton("'file' is in externalStorageDirectory", Ti.Filesystem.externalStorageDirectory + "/fruit.jpg", "http://southernbite.com/wp-content/uploads/2012/05/SouthernBiteFruitSalad-2.jpg"));
       
      win.add(imageView);
       
      win.open();
      

      Null should only be shown for the first two buttons but it shown for all buttons unlike on Android.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kiguchi Kota Iguchi
                Reporter:
                smohammed Samir Mohammed
                Reviewer:
                Gary Mathews
                Tester:
                Keerthi Mahalingam (Inactive)
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code