This question is locked. New answers and comments are not allowed.
Hi, I'm expreriencing problem getting the right size of the file in byte[].
Here's my scenario: I'm uploading the file and then get the byte[] size and save it to db. When i try to upload a e.g. 4mb docx file then it goes to my Raduploadhandler.ashx, I only get the 56kb file size. Is there something wrong with my upload handler?
Here's my scenario: I'm uploading the file and then get the byte[] size and save it to db. When i try to upload a e.g. 4mb docx file then it goes to my Raduploadhandler.ashx, I only get the 56kb file size. Is there something wrong with my upload handler?
| public class RadUploadHandler : Telerik.Windows.RadUploadHandler |
| { |
| Dictionary<string, object> dict = new Dictionary<string, object>(); |
| public override void ProcessStream() |
| { |
| string submissionID = Request.Form["SubmissionID"]; |
| string submitter = Request.Form["UserAlias"]; |
| byte[] assetData = Convert.FromBase64String(Request.Form["RadUAG_data"]); |
| this.AddReturnParam("RadUAG_associatedData", ""); |
| this.AddReturnParam("RadUAG_finalFileRequest", this.IsFinalFileRequest()); |
| this.AddReturnParam("RadUAG_success", true); // or false if something fails |
| this.AddReturnParam("RadUAG_message", "");// or add an error message if it is needed |
| string fileName = this.Request.Form["RadUAG_fileName"]; |
| string filePath = this.GetFilePath(fileName); |
| this.AddReturnParam("RadUAG_fileIdent", filePath); |
| this.AddReturnParam("RadUAG_fileName", fileName); |
| this.AddReturnParam("RadUAG_filePath", filePath); |
| if (IsFinalFileRequest()) |
| { |
| byte[] buffer = Convert.FromBase64String(this.Request.Form["RadUAG_data"]); |
| long attachmentID = SaveFileToDB(buffer, fileName, Convert.ToInt64(submissionID), submitter); |
| dict.Add("AttachmentID", attachmentID); |
| string associatedDataString = String.Empty; |
| if (dict.Count > 0) |
| { |
| foreach (string key in dict.Keys) |
| { |
| object value = dict[key]; |
| if (value == null) |
| { |
| value = "null"; |
| } |
| value = "\"" + value.ToString().Replace("\\", "\\\\") + "\""; |
| associatedDataString += "{" + String.Format(@"""Key"":""{0}"",""Value"":{1}", key, value) + "},"; |
| } |
| associatedDataString = associatedDataString.TrimEnd(','); |
| } |
| this.AddReturnParam("RadUAG_associatedData", associatedDataString); |
| } |
| } |