using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Threading.Tasks; using SDKCSharp.Utility; namespace SDKCSharp.Common { public class UploadFile { /// /// 添加上传文件 /// /// 表单名称,不能重复 /// 文件路径 public UploadFile(string name, string filePath) : this(name, FileUtil.GetFileName(filePath), FileUtil.ReadFile(filePath)) { } /// /// 添加上传文件 /// /// 表单名称,不能重复 /// 文件名称 /// 文件流 public UploadFile(string name, string fileName, FileStream fileStream) : this(name, fileName, FileUtil.ReadFile(fileStream)) { } /// /// 添加上传文件 /// /// 表单名称,不能重复 /// 文件名称 /// 文件内容 public UploadFile(string name, string fileName, byte[] fileData) { this.name = name; this.fileName = fileName; this.fileData = fileData; this.md5 = MD5Util.Encrypt(fileData); } private string name; public string Name { get { return name; } } private string fileName; public string FileName { get { return fileName; } } private byte[] fileData; public byte[] FileData { get { return fileData; } } private string md5; public string Md5 { get { return md5; } } } }