From 9bcadf03cd493f07a953a2175c368a9f59cea7b8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 16 May 2013 22:32:23 -0400 Subject: [PATCH] fixed ie10 image uploading --- ApiClient.js | 10 ++++++---- packages.config | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ApiClient.js b/ApiClient.js index 1c5c6339aa..a46fe34874 100644 --- a/ApiClient.js +++ b/ApiClient.js @@ -922,7 +922,8 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { // Closure to capture the file information. reader.onload = function (e) { - var data = window.btoa(e.target.result); + // Split by a comma to remove the url: prefix + var data = e.target.result.split(',')[1]; var url = self.getUrl("Users/" + userId + "/Images/" + imageType); @@ -941,7 +942,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }; // Read in the image file as a data URL. - reader.readAsBinaryString(file); + reader.readAsDataURL(file); return deferred.promise(); }; @@ -979,7 +980,8 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { // Closure to capture the file information. reader.onload = function (e) { - var data = window.btoa(e.target.result); + // Split by a comma to remove the url: prefix + var data = e.target.result.split(',')[1]; var url = self.getUrl("Items/" + itemId + "/Images/" + imageType); @@ -998,7 +1000,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }; // Read in the image file as a data URL. - reader.readAsBinaryString(file); + reader.readAsDataURL(file); return deferred.promise(); }; diff --git a/packages.config b/packages.config index 18aa38dd61..8420a4504e 100644 --- a/packages.config +++ b/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file