IsValidMimeType throwing NullReferenceException in Chrome

Thread is closed for posting
4 posts, 0 answers
  1. Debbie Wright
    Debbie Wright avatar
    14 posts
    Member since:
    Aug 2007

    Posted 15 Dec 2009 Link to this post

    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
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1600 posts

    Posted 17 Dec 2009 Link to this post

    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.
  3. Debbie Wright
    Debbie Wright avatar
    14 posts
    Member since:
    Aug 2007

    Posted 17 Dec 2009 Link to this post

    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.
  4. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1600 posts

    Posted 23 Dec 2009 Link to this post

    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.
Back to Top