MurDoGG Posted July 21, 2009 Share Posted July 21, 2009 Hi folkz,i'm using following code to download files in a javascript script: try { if (XMLHttpRequest.readyState == 4) { var fileName = XMLHttpRequest.responseText; fileName = fileName.substring(6, fileName.length - 2); if (fileName != null && fileName != "") { var fsr = new ActiveXObject("ADODB.Stream"); fsr.Type = 1; fsr.Open; fsr.LoadFromFile(fileName); var fsw = new ActiveXObject("ADODB.Stream"); fsw.Type = 1; fsw.Open; fsw.Write(fsr.Read); fsw.SaveToFile(newFileName); fsw.Close; } } } catch(e) { System.Debug.outputString(e); } Everything works fine, if i'am on my local system, so i can read files from my hard drive.What isn't possible apperntly, load files from a netowrk path, like \\server\path\file.ext, or i don't know how :)Following error information are availible:Errordescription: "'$lineinfo' ist undefiniert"Errormessage: "'$lineinfo' ist undefiniert"Errorname: TypeErrorErrornumber: -2146823279Someone have i idea where the fault is or what i have to do to read files from network path. If i should specify the filetype, i want to load zip files (don't know this is a relevant information).Kind regardsMurDoGG Link to comment Share on other sites More sharing options...
justsomeguy Posted July 21, 2009 Share Posted July 21, 2009 You're not calling the functions correctly, in Javascript you need parentheses after the function names. e.g.:fsr.Open(); Link to comment Share on other sites More sharing options...
MurDoGG Posted July 21, 2009 Author Share Posted July 21, 2009 You're not calling the functions correctly, in Javascript you need parentheses after the function names. e.g.:fsr.Open();Sorry my fault, i think it is JScript, not JavaScript. The source works, no problem with local path like C:\somefile.ext the problem isto access a network path like: \\10.0.0.1\folder\file.ext Link to comment Share on other sites More sharing options...
justsomeguy Posted July 21, 2009 Share Posted July 21, 2009 JScript is Microsoft's implementation of Javascript, the same rules apply. Change the calls for the open and close methods and see if that makes a difference. Link to comment Share on other sites More sharing options...
MurDoGG Posted July 22, 2009 Author Share Posted July 22, 2009 JScript is Microsoft's implementation of Javascript, the same rules apply. Change the calls for the open and close methods and see if that makes a difference.Mens, i don't write my post for trash, i wrote already, that its okay in the JScript implementation, to forget the "()". It WORKS. Please only write comments, if you understand the problem and have a solution. Time is money, perhaps you know. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 22, 2009 Share Posted July 22, 2009 No problem, if you're happy running poorly-formed code, regardless of how it runs, then I'm happy too. I'll leave you to it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.