|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I have used the following javascript code in asp.net file.When I run it, an error is thrown while executing the last statement that is "oStr.SaveToFile("C:\3of9.TTF",2);" The error is "Write to file failed" Can anyone pls let me know what could be the cause of the error? The same code works fine in ASP but I used MSXML.XMLHTTP instead of MSXML2.ServerXMLHTTP Thanks. function download() { var ua = navigator.userAgent.toLowerCase(); var adTypeBinary = 1; var adSaveCreateOverwrite = 2; var adModeReadWrite = 3; // Create an xmlhttp object var xmlHTTP = new ActiveXObject( "MSXML2.ServerXMLHTTP" ); //var xmlHTTP = new ActiveXObject( "MSXML.XMLHTTP" ); xmlHTTP.open( "GET", "http://localhost/training/3of9.TTF", false ); // Actually Sends the request and returns the data xmlHTTP.send; contents = xmlHTTP.responseBody; var oStr = new ActiveXObject("ADODB.Stream"); oStr.Mode = adModeReadWrite; oStr.Type = adTypeBinary; oStr.Open; oStr.Write(contents); alert(ua.indexOf("windows nt 5.0")); if (ua.indexOf("windows nt 5.0")!= -1) oStr.SaveToFile("C:\3of9.TTF",2); } |
|
#2
|
||||
|
||||
|
Javascript? Client side or server-side? You can't write files on the client-side.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > xmlHTTP - Write to file failed error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|