I'm getting problem while using below code. It is working on local mechin. But i uploaded remote location and using application it shown an error source path wrong. please find the below code.
string sourcePath = System.IO.Path.GetDirectoryName (FileUpload1.PostedFile.FileName);
string targetPath = @"e:\\PODetails";
foreach (string sourceFilePath in Directory.GetFiles(@sourcePath))
string fileName = Path.GetFileName(sourceFilePath);
string destinationFilePath = Path.Combine(targetPath, fileName);
File.Copy(sourceFilePath, destinationFilePath, true);
I would be tempted to check the following
1. Make sure that the remote machine has all the necessary permissions on the folders in question, if behind a firewall then check the settings also
2. Put a break point on the rountine, step through the code and make sure that the paths and filename are correct.
If you paste the contents of the sourcePath into your either your search line of start, or the run pop box, does it go to that path, or do you get an error there as well?
This is a good way to test if your path is valid on your sourcePath.
In addition, if you do this on the different machine/remote location, what happens?
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)