Click here to Skip to main content
15,922,407 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Suppose I have one directory, say Hostedwebsite, from this directory web site is running now.
I want to upload some files so that I don't want to save these file Under hosted Hosted folder reside in C:\Root.

I want to save file in other path say D: UploadedFile//directory
for every upload new directoy will get created
so server.mappath will give the path of C but i want to copy file in D Drive..

I got the path using string
Path = System.IO.Path.Combine(rootPath, test);

But while I am copying from local system to another system using below code.

File.Copy(attachementList[index].FilePath, Path + "\\\\" + attachementList[index].FileName);

It is giving IO exception device not ready.

Can youu guys give me idea?
Posted
Updated 2-Sep-10 4:06am
v3
Comments
Dalek Dave 2-Sep-10 9:55am    
I started to edit this to try and turn it into something readable when I realised it made no sense whatsoever.

1 solution

One, you need to make sure the folder exists before trying to copy to it, and two, the destination path is most likely incorrect, too many path delimiters. You are probably getting something like d:\Uploaded File\\\file.txt. YOU used Path.Combine once, why not use it again?
 
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