diff --git a/examples/simple/controllers.js b/examples/simple/controllers.js index 625bdc7..86745ca 100644 --- a/examples/simple/controllers.js +++ b/examples/simple/controllers.js @@ -9,7 +9,8 @@ angular .controller('AppController', ['$scope', 'FileUploader', function($scope, FileUploader) { var uploader = $scope.uploader = new FileUploader({ - url: 'upload.php' + url: 'upload.php', + xhrTimeout: 30000 }); // FILTERS diff --git a/src/services/FileUploader.js b/src/services/FileUploader.js index 96f7cbc..3eb5dd5 100644 --- a/src/services/FileUploader.js +++ b/src/services/FileUploader.js @@ -17,14 +17,14 @@ let { export default function __identity(fileUploaderOptions, $rootScope, $http, $window, $timeout, FileLikeObject, FileItem) { - - + + let { File, FormData } = $window; - - + + class FileUploader { /********************** * PUBLIC @@ -36,7 +36,7 @@ export default function __identity(fileUploaderOptions, $rootScope, $http, $wind */ constructor(options) { var settings = copy(fileUploaderOptions); - + extend(this, settings, options, { isUploading: false, _nextIndex: 0, @@ -493,6 +493,8 @@ export default function __identity(fileUploaderOptions, $rootScope, $http, $wind xhr.withCredentials = item.withCredentials; + xhr.timeout = this.xhrTimeout; + forEach(item.headers, (value, name) => { xhr.setRequestHeader(name, value); }); @@ -745,15 +747,15 @@ export default function __identity(fileUploaderOptions, $rootScope, $http, $wind */ FileUploader.isHTML5 = FileUploader.prototype.isHTML5; - + return FileUploader; } __identity.$inject = [ - 'fileUploaderOptions', - '$rootScope', - '$http', + 'fileUploaderOptions', + '$rootScope', + '$http', '$window', '$timeout', 'FileLikeObject',