using System;
using System.IO;
namespace OSS.Http.Models
{
public struct FileParameter
{
///
/// 构造函数
///
/// 参数的名称
/// 调用方会自动释放
///
///
public FileParameter(string name, Stream fileStream, string filename, string contentType)
{
this.Writer = s =>
{
var buffer=new byte[1024];
using (fileStream)
{
int readCount = 0;
while ((readCount= fileStream.Read(buffer, 0, buffer.Length))!=0)
{
s.Write(buffer,0,readCount);
}
}
};
this.FileName = filename;
this.ContentType = contentType;
this.Name = name;
}
///
/// 参数名称
///
public string Name;
///
/// 读写操作流
///
public Action Writer;
///
/// 文件名称
///
public string FileName;
///
/// 文件类型
///
public string ContentType;
}
}