I'm trying to copy files from a local pc to a server with file.copy. but whitou succes. there are no error but it doesn't show up on the server. my Permissons are alright thow.
here is what i do.
public static void UploadFiles(string path, string[] files,
string[] uploadPlace, ObserverDelegate observerDelegete)
{
try
{
Directory.CreateDirectory(path);
for (int i = 0; i < files.Count(); i++)
{
observerDelegete(files[i]);
File.Copy(files[i], uploadPlace[i]);
}
}
catch (UnauthorizedAccessException uoe) { }
catch (FileNotFoundException fnfe) { }
catch (Exception e) { }
}
There is no error because you're catching and swallowing all of the possible exceptions...
catch (UnauthorizedAccessException uoe) { }
catch (FileNotFoundException fnfe) { }
catch (Exception e) { }
which effectively masks the errors from you as a programmer. Take those statements out, recompile the code, and see what exceptions get thrown.
It's likely a permissions or network connectivity issue. Windows is nice enough to let you know for sure.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.