Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
2.75/5 (4 votes)
See more:
Hi,
I am trying to copy a file from my local to remote server through an application. It should not use fileupload control. If I am specifies the local path in a text box and click a button means, the file present in the path should be copied to a path in remote server. I can do this if i specified the destination as a local server path. But cant if i specified the remote server path. How can I do this?

I used File.Copy(sourceFileName, destFileName). If i used this method and specify the 'destFileName' as remote server path, it is not working.

Thanks in advance.
Posted
Updated 17-Jul-12 2:15am
v2
Comments
[no name] 17-Jul-12 8:32am    
Do you think that "it is not working" is a good description of the problem that you are having? Do you call your mechanic on the phone and tell that your "car is broke" and expect that he knows exactly what you are talking about?

1 solution

You need to decide by what mechanism you're going to transfer the file. If it's a straight copy, you may want to share a folder on the server so that the account your process runs under can access it.

If the server is running an ASP website, perhaps you want to have an upload page which can handle it.
 
Share this answer
 
Comments
maajanes 17-Jul-12 8:18am    
I used File.Copy(sourceFileName, destFileName). If i used this method and specify the 'destFileName' as remote server path, it is not working.
[no name] 17-Jul-12 8:27am    
You already said that. Did you share the remote server folder so that it would be accessible to copy files to?
Tejas Vaishnav 17-Jul-12 8:41am    
yes using shared folder, you can use File.Copy.
maajanes 17-Jul-12 8:44am    
Can you please elobrate?
maajanes 17-Jul-12 8:46am    
I gave the destination folder(remote server path) as, Request.ServerVariables["APPL_PHYSICAL_PATH"] + "NewFolder\\";. Yet its not accessible

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