日期:2014-05-17 浏览次数:20368 次
FileProgress progress = new FileProgress();
int length = ulf.FileLength;
progress.TotalSize = length;
byte[] FileArray = new Byte[length];
int index = 0;
byte[] b = new byte[5000];
int getByteSize = ulf.FileData.Read(b, 0, b.Length);
while (getByteSize > 0)
{
Array.Copy(b, 0, FileArray, index, getByteSize);
index += getByteSize;
Thread.Sleep(100);
progress.CurrSize = index;
HttpContext.Current.Session[file_key] = progress;
getByteSize = ulf.FileData.Read(b, 0, b.Length);
}
FileAttachment attach = new FileAttachment();
attach.FieldName = ulf.ConditionField;
attach.FileData = FileArray;
attach.FileLength = length;
attach.FileName = ulf.FileName;
attach.FormId = new Guid(ulf.FormId);
attach.InstanceId = new Guid(ulf.InstanceId);
public class FileUploadProgressHandler : IHttpHandler,IRequiresSessionState
{
Double Percentage = 0.00;
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/json";