This is a migrated thread and some comments may be shown as answers.

IsValidMimeType throwing NullReferenceException in Chrome

3 Answers 60 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Debbie Wright
Top achievements
Rank 1
Debbie Wright asked on 15 Dec 2009, 03:54 PM
I've been receiving the following error messages from my website:

System.NullReferenceException: Object reference not set to an instance of an object. at Telerik.Web.UI.RadUpload.IsValidMimeType(UploadedFile file) at Telerik.Web.UI.RadUpload.IsValidUploadedFile(UploadedFile file, Boolean checkingFileSize, Boolean checkingFileExtension, Boolean checkingMimeType) at Telerik.Web.UI.RadUpload.ValidateUploadedFiles() at Telerik.Web.UI.RadUpload.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

the user agent is :
HTTP_USER_AGENT:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.33 Safari/532.0

I'm guessing the problem is that the user is using chrome, and for some reason it's stripping the document of a mime type. Is there any workaround that anyone know of for this, or a fix? right now I'm catching the error and telling the user to use Firefox or IE, as it works perfectly there.
this is the code for the upload control
<telerik:RadUpload ID="upldResume" runat="server"  
                    ControlObjectsVisibility="ClearButtons" 
                    InputSize="50" 
                    Width="475px" 
                    MaxFileSize="500000" 
                    MaxFileInputsCount="1" 
                    ReadOnlyFileInputs="true" 
                    Enabled="true" 
                    EnableFileInputSkinning="true" 
                    AllowedFileExtensions=".pdf,.doc,.docx,.wpd,.odt,.rtf,.txt" 
                    AllowedMimeTypes="application/pdf,application/x-pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/wordperfect,application/x-wpwin,application/vnd.oasis.opendocument.text,application/x-vnd.oasis.opendocument.text,application/rtf,application/x-rtf,text/richtext,text/rtf,text/enriched,application/txt,text/plain" 
                    ToolTip="Upload a resume" 
                    /> 

Thank you,
Debbie

3 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 17 Dec 2009, 05:53 PM
Hi Debbie Wright,

I was not able to reproduce the error using the markup you have provided. On my side it is working correctly. I have attached my sample project, is it possible to modify it in a way that reproduces the error? 


Kind regards,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Debbie Wright
Top achievements
Rank 1
answered on 17 Dec 2009, 06:07 PM
I cannot reproduce the error either, I do not have a chrome or safari environment to test in.
I only get these error messages email to me by the site.
so far no one has complained, so I can't find out what the true environment is, or the particulars of the document being uploaded.

the only thing I can think of is that the document doesn't have a mime-type, so it's triggering that error.
0
Genady Sergeev
Telerik team
answered on 23 Dec 2009, 02:41 PM
Hello Debbie Wright,

The UploadedFile class inherits the .NET PostedFile class and much if its properties come from there, including the ContentType one. So it seems that you have found bug in the ASP.NET implementation. I have tried to reproduce the error, however ,without information regarding the environment I lacked any success.

I would suggest that you use AllowedFileExtensions instead of MimeTypes. Is there any specific reason for which you want to use MimeTypes?

Best wishes,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Upload (Obsolete)
Asked by
Debbie Wright
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Debbie Wright
Top achievements
Rank 1
Share this question
or