Hi,
This is the code I have:
--------------------------------------------------------
// File handler
guac.onfile = function(stream, mimetype, filename) {
console.log("Stream: ", stream)
console.log("Mime type: ", mimetype)
console.log("File name: ", filename)
if (!window.location.origin)
var streamOrigin = window.location.protocol + '//' +
window.location.hostname + (window.location.port ? (':' +
window.location.port) : '');
else
var streamOrigin = window.location.origin;
console.log("Stream origin: ", streamOrigin)
// Build download URL
var url = streamOrigin
+ window.location.pathname
+ '/api/session/tunnels/' + encodeURIComponent(tunnel.uuid)
+ '/streams/' + encodeURIComponent(stream.index)
+ '/' + encodeURIComponent(filename.replace(/[\\\/]+/g, '_'))
//+ '?token=' + encodeURIComponent(myToken);
console.log("URL: ", url)
console.log("Tunnel: ", tunnel)
// Create temporary hidden iframe to facilitate download
var iframe = document.createElement('iframe');
iframe.style.position = 'fixed';
iframe.style.border = '1px solid black';
iframe.style.width = '100px';
iframe.style.height = '100px';
iframe.style.left = '20px';
iframe.style.top = '-1px';
// The iframe MUST be part of the DOM for the download to occur
document.body.appendChild(iframe);
// Acknowledge (and ignore) any received blobs
stream.onblob = function() {
console.log("***** Blob *****")
stream.sendAck('OK', Guacamole.Status.Code.SUCCESS);
};
// Begin download
iframe.src = url;
}
--------------------------------------------------------
It does print the name of the file when I drop a file in the 'download'
folder on the virtual desktop. But the file does not get downloaded to the
local machine. I have the websocket service that extends
GuacamoleWebSocketTunnelEndpoint to return the tunnel.
I am not sure if a token is needed to build the download url and if yes, how
do I get this token? And what else am I missing? Any kind of help or
examples will be much appreciated. Thanks so much.
--
Sent from:
http://apache-guacamole-general-user-mailing-list.2363388.n4.nabble.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]