public bool TryUploadFile(AudioLog audioLog) { try { var fullpath = $"{GetFolder(audioLog.TimeOfLog)}\\{Path.GetFileName(audioLog.GetMp3())}"; File.Copy(audioLog.GetMp3(), fullpath); } catch (Exception e) { Logger.Error(e.Message); return(false); } return(true); }
public bool TryUploadFile(AudioLog audioLog) { _client = new WebClient { Credentials = new NetworkCredential(_username, _password), Proxy = null }; try { var address = $"ftp://{_host}/{_targetDirectory}/{Path.GetFileName(audioLog.GetMp3())}"; _client.UploadFile(address, "STOR", audioLog.GetMp3()); } catch (Exception exception) { Logger.Warn(exception.Message); return(false); } return(true); }