Add basic support for file upload via dragging.

This commit is contained in:
Michael Jumper
2013-09-23 20:52:11 -07:00
parent 4a0003b53d
commit 94c0ec1f17
2 changed files with 121 additions and 0 deletions

View File

@@ -533,6 +533,53 @@ Guacamole.Client = function(tunnel) {
tunnel.sendMessage("clipboard", data);
};
/**
* Opens a new file for writing, having the given index, mimetype and
* filename.
*
* @param {Number} index The index of the file to write to. This index must
* be unused.
* @param {String} mimetype The mimetype of the file being sent.
* @param {String} filename The filename of the file being sent.
*/
this.openFile = function(index, mimetype, filename) {
// Do not send requests if not connected
if (!isConnected())
return;
tunnel.sendMessage("file", index, mimetype, filename);
};
/**
* Given the index of a file, writes a blob of data to that file.
*
* @param {Number} index The index of the file to write to.
* @param {String} data Base64-encoded data to write to the file.
*/
this.sendBlob = function(index, data) {
// Do not send requests if not connected
if (!isConnected())
return;
tunnel.sendMessage("blob", index, data);
};
/**
* Marks a currently-open file as closed.
*
* @param {Number} index The index of the file to close.
*/
this.closeFile = function(index) {
// Do not send requests if not connected
if (!isConnected())
return;
tunnel.sendMessage("end", index);
};
/**
* Fired whenever the state of this Guacamole.Client changes.
*