public void Execute(ELImageDeviceElement element, String strLot) { strImageFullPath = CommonFun.GetFullPath(element.SourceImagePathRoot, element.SourceImagePathFormat); string strFileName = strImageFullPath + strLot + "." + element.ImageExtensionName; FileInfo fInfo = new FileInfo(strFileName); FtpManager.UploadFile(fInfo, element.FtpTargetFolder, element.FtpServer, element.FtpUser, element.FtpPassword); }
public static string UploadFile(string strFileName, ELImageDeviceElement element) { string strMessage = ""; try { if (File.Exists(strFileName)) { FileInfo fInfo = new FileInfo(strFileName); FtpManager.UploadFile(fInfo, element.FtpTargetFolder, element.FtpServer, element.FtpUser, element.FtpPassword); strMessage = string.Format("上传图片({0})成功", strFileName); } else { strMessage = string.Format("图片({0})不存在", strFileName); } } catch (Exception err) { strMessage = err.Message; } return(strMessage); }