GUAC-1172: Implement file upload through object streams.

This commit is contained in:
Michael Jumper
2015-07-03 13:07:19 -07:00
parent cfd3710bf2
commit daf52dee5e
4 changed files with 62 additions and 4 deletions

View File

@@ -27,6 +27,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
function clientController($scope, $routeParams, $injector) {
// Required types
var ManagedClient = $injector.get('ManagedClient');
var ManagedClientState = $injector.get('ManagedClientState');
var ManagedFilesystem = $injector.get('ManagedFilesystem');
var ScrollState = $injector.get('ScrollState');
@@ -635,6 +636,25 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
ManagedFilesystem.changeDirectory(filesystem, file);
};
/**
* Begins a file upload through the attached Guacamole client for
* each file in the given FileList.
*
* @param {FileList} files
* The files to upload.
*/
$scope.uploadFiles = function uploadFiles(files) {
// Ignore file uploads if no attached client
if (!$scope.client)
return;
// Upload each file
for (var i = 0; i < files.length; i++)
ManagedClient.uploadFile($scope.client, files[i], $scope.filesystemMenuContents);
};
// Clean up when view destroyed
$scope.$on('$destroy', function clientViewDestroyed() {