Hi guys
I understand that the Upload Handler splits files into chunks by design, in my case its splitting a 4 MB file into like 40 chunks and saving them to the DB, without using the BufferSize Property how can i save the whole file? or rather how do these chunks add up to my original file?
I've tried doing somthing like the below code, now my only problem with this is that its only taking the last Chunk and saving it to the DB?
public override void ProcessStream()
{
base.ProcessStream();
if(IsFinalFileRequest())
{
var entity = Int16.Parse(Request.Form["0_SysEntityID"]);
var userID = Int64.Parse(Request.Form["0_UserID"]);
var itemID = Int64.Parse(Request.Form["0_ItemID"]);
var document = Request.Form["0_Filename"];
var ext = document.Substring(document.LastIndexOf("."));
var documentName = document.Replace("." + ext, "");
var contentLength = Request.Files[0].ContentLength;
var mimeType = Request.Files[0].ContentType;
var content = new byte[contentLength];
Request.Files[0].InputStream.Read(content, 0, contentLength);
SqlUtilities.ExecuteNonQuery(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString,
"Pr_DocumentInsert",
CommandType.StoredProcedure,
new SqlParameter("@DocumentName", documentName),
new SqlParameter("@DocumentExt", ext),
new SqlParameter("@DocumentContent", content),
new SqlParameter("@DocumentSize", contentLength),
new SqlParameter("@MimeType", mimeType),
new SqlParameter("@SysEntityID", entity),
new SqlParameter("@ItemID", itemID),
new SqlParameter("@UserID", userID));
}
Your help in this regard will be highly apreciated,