Hello,
I have a question I hope someone has an answer for.
I have a custom control that includes the RadAsyncUpload control. In the onInit event handler calculate a MaxFileSize based on a config file setting and then register a couple of scripts to handle the error display if the file being uploaded exceeds the MaxFileSize:
i.e
StringBuilder sb = new StringBuilder();
sb.Append("\n\t<script type=\"text/javascript\">\n\t\tfunction UploadValidationError(sender, eventArgs)\n\t\t{\n\t\t\talert('")
.Append(AlertText1)
.Append(": ' + eventArgs.get_fileName() + ' ")
.Append(AlertText2).Append(" ")
.Append(MaxFileSize.ToString())
.Append(" kb.\');\n\t\t}\n\t</script>");
Page.Header.Controls.Add(new LiteralControl(sb.ToString()));
StringBuilder sb2 = new StringBuilder();
sb2.Append("\n\t<script type=\"text/javascript\">\n\t\tfunction FileUploadError(sender, eventArgs)\n\t\t{\n\t\t\talert('")
.Append(AlertText3)
.Append(" ' + eventArgs.get_message() );\n\t\t}\n\t</script>");
Page.Header.Controls.Add(new LiteralControl(sb2.ToString()));
Then when the RadAsyncUpload control is being added to the
public Telerik.Web.UI.RadAsyncUpload _uploadControl = new Telerik.Web.UI.RadAsyncUpload();
this._uploadControl.ID = "u" + this.QuestionID;
this._uploadControl.InitialFileInputsCount = 1;
this._uploadControl.MaxFileInputsCount = 1;
this._uploadControl.MaxFileSize = MaxFileSize;
this._uploadControl.FileUploaded += new FileUploadedEventHandler(File_FileUploaded);
this._uploadControl.TemporaryFolder = _fileVirtualPath;
this._uploadControl.TargetFolder =_fileVirtualPath ;
this._uploadControl.HttpHandlerUrl = "~/RadUpload/RadUploadFile.ashx";
this._uploadControl.Width = new Unit(250);
this._uploadControl.CssClass = "normalRemoveButton";
this._uploadControl.OnClientValidationFailed = "UploadValidationError";
this._uploadControl.OnClientFileUploadFailed = "FileUploadError";
this._uploadControl.Style.Add("display", "block");
this._uploadLabel.Text = NoFileSelectedText;
this._uploadLabel.Enabled = false;
this._uploadControl.Culture = new System.Globalization.CultureInfo(CultureCode);
This all works flawlessly on most browsers, select a file too large and the alert box pops up indicating that the filesize exceeds the limit. However on some testers machines, when they select a file to upload that is way too large , the yellow uploading line activates, the alert box does not show, and it continues in that state for several minutes if you let it.
(I am not even sure that it is browser related, it may be individual machines and the browser configutration). It does not seem to be version specific, we have tried this under IE7, IE8, and IE9.
Any ideas?
Thanks,
Gary