tags:

views:

134

answers:

2

How to move file from one server to another server? Plz help When user uploading the excel file i am moving that file to another server this is the code i am using.....

string destFilename = @"\\192.168.1.2" + @"\\xyz\\xyz1\\" +
    fileName + "";
System.IO.File.Copy(filePath, destFilename);
A: 

Not sure exactly what you want, but here is a sample that transfers files using webservices http://articles.techrepublic.com.com/5100-10878_11-5805105.html

almog.ori
+1  A: 

Your destination path is wrong it would turn out to be

\\192.168.1.2\\sabre\\Mapping Rules Upload\\<filename>

you need 1 slash in each directory seperator

You either need

string destFilename = @"\\192.168.1.2" + @"\sabre\Mapping Rules Upload\" + fileName + "";

or if you remove the "@" then you need to escape each "\" with another "\"

string destFilename = "\\\\192.168.1.2" + "\\sabre\\Mapping Rules Upload\\" + fileName + "";

The @ sign just saves you escaping chars that require escaping in a string!

EDIT: I am presuming that in your code fileName and filePath are set correctly!

HTH

OneSHOT

OneSHOT