Msg File ContentType Null

6 posts, 0 answers
  1. Greg
    Greg avatar
    5 posts
    Member since:
    Sep 2012

    Posted 30 Jul 2015 Link to this post

    Hi,

     

    I am using Telerik.Web.UI.RadAsyncUpload v4.0.30319

    ContentType for MSG Files are always returning as null. I tried uploading file with HtmlInputFile control, and that retrieves it fine. How can I get it to work with RadAsyncUpload ?

     

    Note: I have the mime type (.msg application/vnd.ms-outlook) set in my local IIS where I am running my site.

     

    Thanks

    Purna

  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 03 Aug 2015 Link to this post

    Hi Greg,

    What is your browser? Can you test the following html:

    <div>
        Select .msg file.
    </div>
    <input type="file" id="fileInput" onchange="fileSelected()" />
     
    <script type="text/javascript">
        function fileSelected() {
            var input = document.getElementById('fileInput');
            var file = input.files[0];
            alert(file.type);
        }
    </script>

    It look like that msg it's not a valid or media-type of HTTP/1.1, according to this post http://stackoverflow.com/questions/11182968/determining-unknown-content-types-with-the-html5-file-api .

    Regards,
    Hristo Valyavicharski
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Michael
    Michael avatar
    27 posts
    Member since:
    May 2011

    Posted 05 Aug 2015 Link to this post

    I too am having this issue and it was working fine before - neither Chrome nor IE are passing the ContentType for .msg files via the Rad AsyncUpload control.  I have tried adding the MIME type to both IIS and my local registry and neither change has had any effect.  I respectfully submit that the only change that I am aware of is an update to the latest build of Telerik controls so can any of the changes applied thereto be causing this issue - I don't want to have to hardcode for something that was working fine before.
  5. Michael
    Michael avatar
    27 posts
    Member since:
    May 2011

    Posted 05 Aug 2015 Link to this post

    One other thing to mention - we have an MVC application that use the MVC file upload control and it has no issues with the .msg file - it passes the MIME type (Content Type) just fine so that too also lends credence to the fact that something in the AJAX asyncfileupload control has been changed which is causing this break.  Please investigate and respond.
  6. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 06 Aug 2015 Link to this post

    The problem here is caused by the File Api. It doesn't return Content Type for the .msg files.
    RadAsyncUpload can upload files in four different ways: IFrame, Silverlight, Flash, FileAPI. They are described here Upload Modules. File Api is the most advanced and offers the richest features, thats why it is used by default. However it is possible to disable it and submit files with the form (IFrame). This way it will act as the standard aspnet upload control. Using this option you can read the content type directly on the server. Perhaps your MVC upload do the same. 

    <script type="text/javascript">
       //Disable File Api
       Telerik.Web.UI.RadAsyncUpload.Modules.FileApi.isAvailable = function () { return false; }
    </script>
    <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" DisablePlugins="true">
              </telerik:RadAsyncUpload>
              <asp:Button runat="server" ID="Button1" Text="Submit" OnClick="Button1_Click" />
    protected void Button1_Click(object sender, EventArgs e)
    {
      string type = RadAsyncUpload1.UploadedFiles[0].ContentType;
    }

    I hope this helps.

    Regards,
    Hristo Valyavicharski
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Greg
    Greg avatar
    5 posts
    Member since:
    Sep 2012

    Posted 06 Aug 2015 in reply to Hristo Valyavicharski Link to this post

    Hi Hristo,

    Sorry for delayed reply. I tried your very first html in Chrome and FF, it alerts blank. But on the server side, HttpPostedFile's ContentType property returns "application/octet-stream"

    For now, I am going to set the ContentType manually by checking the file extension for msg types.

    Thanks 

     

     

     

     

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017