Flooux - Monday, July 30, 2012 4:58 AM:
Hi,
I want to download a existing file in a vault to the client working directory in order to open it in a .dwg viewer.
but i always get the following error :
See the code below :
<html>
<head>
<script src="../../javascript/QueryString.js" type="text/javascript"></script>
</head>
<body bgcolor="#ffffff" topmargin="0" marginheight="0" leftmargin="0" marginwidth="0"
scroll="no">
<script type="text/javascript">
// Get the URL
var file_url = QueryString("file_url").toString();
// Dateinamen aus der URL extrahieren
var filename = file_url.substr(file_url.search("&fileName=")+10);
filename = filename.substr(0,file_url.search("&vaultId="));
filename = decodeURI(filename);
alert("filename = "+filename);
file_url = encodeURI(file_url);
alert("file url = " + file_url);
// Get workdir
var workdir = top.aras.vault.GetWorkingDir();
alert("workdir = " + workdir);
// Set filename
top.aras.vault.setLocalFileName(filename);
// download file
var res = top.aras.vault.downloadFile(file_url);
alert("res = "+res);
if ( !res ) top.aras.AlertError("Failed to download the file.", "item_window: "+top.aras.vault.getLastError(), "Client Side Error");
// Build the complete filename including the path
var fullFileName = workdir + filename;
document.write(
'<object' +
' id="AvViewX1"' +
' width="100%" height="100%"' +
' classid="CLSID:8718C658-8956-11D2-BD21-0060B0A12A50">' +
' <param name="src" value="' + file_url + '">' +
' <param name="EnableUIMode" value="DefaultUI">' +
' <param name="BackgroundColor" value="000033">' +
'</object>'
);
</script>
</body>
</html>
gks by TSI - Wednesday, August 1, 2012 5:18 AM:
If your vault is set up for secure connections only, you have to use a file_url with a security token in it.
check out the HttpServerConnection..::.getFileUrl Method for some more informations.
alternativly turn of enforce_user_credentials in the vault server config
