Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have code which is written below.
Its working just copying website file to local machine, it works fine when I use it with a network computer, but if I us it with website it does not work.
I would like to copy website files into my local machine, the file extension is .csv.

Below is my code:
JavaScript
<html>
    <BODY >
    <script language="JScript">
    function copy()
    {
var ss;
var name = '\\\\131.0.0.202\\ks\\myfile\\ab.csv';
//var name = 'https://www.mnps.in/ab.csv';
var fl = new ActiveXObject("Scripting.FileSystemObject");
fileobj=fl.GetFile(name);
ss=fl.CopyFile(fileobj,"c:\\ab1.csv");
window.close();
}
    </script>
    Copying data from network and paste it into local.
    <form name="myForm" >
    <INPUT type="Button" value="Copy File" onload="copy();">
    </form>
    </BODY>
    </html>

I am using the same code with two different files. First as HTML and 2nd as HTML application(.hta) both work the same, but when I use it online it does not work at all.

Given IP address is my local network machine.

This code is working in Internet Explorer, but not in Google Chrome and Firefox.

Please help me for that.

Thanks in advance.
Posted
Updated 2-Mar-12 23:47pm
v3
Comments
André Kraak 3-Mar-12 5:47am    
Edited question:
Added pre tags
Formatted text/code
Spelling/Grammar

1 solution

http://msdn.microsoft.com/en-us/library/aa711216(v=vs.71).aspx

If you use the Path property (App.Path), the ChDrive and ChDir statements, or the CurDir function, be aware that they may return a Universal Naming Convention (UNC) path (that is, one beginning with \\Server\Share...) rather than a drive path (such as e:\Folder), depending on how you run your program or project.

The Path should not be a url like 'https://www.mnps.in/ab.csv'.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900