ContentType always application/octet-stream

26 posts, 0 answers
  1. Chris
    Chris avatar
    15 posts
    Member since:
    Sep 2007

    Posted 17 Aug 2010 Link to this post

    The ContentType (aka MIME) is coming in as application/octet-stream, no matter what browser I'm using (IE8, FF, Chrome, etc).  I can't figure out why.  Any input is greatly appreciated.

    Thanks,
    Chris
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 23 Aug 2010 Link to this post

    Hello Chris,

    This is strange. Can you please try uploading a file using the standard ASP.NET FileUpload. How do you check the content type, using the ContentType property of the UploadedFile class? Is the content type still always application/octet-stream?

    Best wishes,
    Genady Sergeev
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chris
    Chris avatar
    15 posts
    Member since:
    Sep 2007

    Posted 23 Aug 2010 Link to this post

    No, the ContentType is correct with the standard ASP.Net control and the RadUpload is correct as well.  I'm using the ContentType of the UploadedFile class.

    I take it this isn't the norm?

  5. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 24 Aug 2010 Link to this post

    Hello Chris,

    Then what is returning incorrect content type? The ContentType property of the UploadedFile class is the correct way to obtain the content type of an uploaded file. As far as I understand from your replay it is returning correct value.

    Regards,
    Genady Sergeev
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  6. Chris
    Chris avatar
    15 posts
    Member since:
    Sep 2007

    Posted 24 Aug 2010 Link to this post

    It's always coming up with "application/octet-stream".  I've attached a screen print of the quick watch window so you can see what in the UploadFile class.  The file I uploaded is a csv file and I am using IE8.

    Here is the code I'm using to get the information:
    foreach (Telerik.Web.UI.UploadedFile file in AsyncUpload.UploadedFiles)
    {
        OLT.SimpleCRM.BLL.Import.File.Item attachment = OLT.SimpleCRM.BLL.Import.File.Item.NewItem();
        attachment.File.FileName = file.GetName();
        attachment.File.MIME = file.ContentType;
        attachment.File.FileData = util.Cast.FileToBytes(fileLoc + file.GetName());
    }


     
  7. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 26 Aug 2010 Link to this post

    Hi Chris,

    I've managed to reproduce the problem, it seems that the Flash module sends the uploaded files with hard-coded content type which is application/octet-stream. I've logged the issue into our bug tracking system and we will try to get it resolved as soon as possible. I've also updated your telerik points as a token of gratitude for the report.

    A possible workaround might be to manually set the ContentType based on the extension of the file. A list with the most common content types can be found here.

    Regards,
    Genady Sergeev
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  8. mastermehdi
    mastermehdi avatar
    39 posts
    Member since:
    Apr 2010

    Posted 29 Aug 2010 Link to this post

    in which version fix this bug?

    it is very important to me?

  9. Jay Leffue
    Jay Leffue avatar
    22 posts
    Member since:
    Nov 2009

    Posted 15 Nov 2010 Link to this post

    This is still an issue.

    The version with Q3 is still operating in this way through flash.

    I have not found a way to tell it to use Silverlight and as its so new I can't find documentation about it.  Would the switch to Silverlight solve this issue, and  thus how do we force it to use Silverlight?
  10. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 18 Nov 2010 Link to this post

    Hello guys,

    Indeed, the content type fix didn't make it for the Q3 release. Please accept our apologies for the delay. The good news are that we are now working on the problem and Q3 Service Pack 1 will have the issue resolved.  Also, the Silverlight module is now a default one, therefore RadAsyncUpload will automatically start adorning the uploaded files with a correct content type as long as the Q3 SP1 release is out. 

    Best wishes,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  11. support
    support avatar
    10 posts
    Member since:
    Aug 2010

    Posted 30 Dec 2010 Link to this post

    Any estimates on when Q3 SP1 would be available? This fix is really crucial for our project's development.

    Cheers,
    Victor
  12. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 30 Dec 2010 Link to this post

    The Q3 sp1 ajax release is out, Victor - I saw that on this page: http://www.telerik.com/products/aspnet-ajax/whats-new.aspx 
  13. Jay Leffue
    Jay Leffue avatar
    22 posts
    Member since:
    Nov 2009

    Posted 03 Jan 2011 Link to this post

    I read the release notes for SP1 but I don't see anything that addresses this issue directly, unless I'm just misreading.  Could you please verify or deny that this fix is in the Service Pack?
  14. support
    support avatar
    10 posts
    Member since:
    Aug 2010

    Posted 03 Jan 2011 Link to this post

    Thanks for the link Prangadj. But I can't seem to find any mention about the ContentType fix in the release notes. Could someone from Telerik clarify this.
  15. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 07 Jan 2011 Link to this post

    Hi guys,

    It turned out that it is not that trivial to implement such feature in the Flash/Silverlight modules. The problem is that there is no way to force Flash/Silverlight to determine the content type based on the meta data of the file. The only way we found to do it, was to scan the selected file name, and match its extension against a list of a known mime types. While this is a good for a workaround, we haven't yet implemented it, but the task is in progress. It should be ready for the upcoming SP2 release. However, If the issue is urgent for you, I can prepare a workaround that you can use immediately.

    Regards,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  16. Jay Leffue
    Jay Leffue avatar
    22 posts
    Member since:
    Nov 2009

    Posted 07 Jan 2011 Link to this post

    Thanks for keeping us informed, much appreciated.

    For my project(s), this is essential for implementing versioning.  Currently, we have told our clients that it is a known issue and just have versioning "off" until it is fixed.

    My main issue is that items can be uploaded using the single uploader in the file explorer or a bulk uploader based on the asyncUpload. The single uploader works as expected.

    I took a stab myself at some process for reading the extension of the file and determining the file type based on some list I found on the internet.  I was through the major types (office products and pdf) and then compared against the data gathered through the single uploader by Telerik.  The types were very different which does not solve the disparity between the two upload methods.  Again, the users can upload now, but as our database grows it will become more difficult for us to implement versioning.

    For me (don't know about other users), I can wait on the service pack.  I can also code up myself an extension checker if given a list of what the Telerik File Explorer uses to populate the file type field so there isn't the disparity between the two upload methods.

    Again, thanks for staying on top of this.
  17. Chris
    Chris avatar
    15 posts
    Member since:
    Sep 2007

    Posted 07 Jan 2011 Link to this post

    Basically, the workaround you have described was what I used to start with when I reported the problem in August.  I have a SQL Server table that contains a list of file extensions.  Once the file is uploaded, we grab the extension and look it up in the SQL table.  This gives us the flexibility to add new extensions at any time.  

    We also save a FK reference to the extension table in the Attachment (where we save the File) table inside of SQL.  If a file extension is not found in the table, it sets the FK reference of the attachment record to the "unknown" extension.  This way we can query and see if any "new" file extensions have been uploaded to that we don't have in the table.  Then a update can be done once we've added the extension.

    Here is a link to an excel file with the file extensions we have in the table.
    http://www.outerlimitstech.com/MIME_Extensions.xlsx

    Chris Straw
  18. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 12 Jan 2011 Link to this post

    Hello Jay Leffue,

    Could you compare the Content-Type that you receive from the uploader inside the File-Explorer to this list. Does the mime-types match?

    Chris, thank you for sharing your approach with the community.

    Greetings,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  19. Jay Leffue
    Jay Leffue avatar
    22 posts
    Member since:
    Nov 2009

    Posted 12 Jan 2011 Link to this post

    Thanks for the reply, some issues with the list:

    It has several mime type for common extensions.  For instance, for excel spreadsheets the supplied list has:

    .xls                      
    application/excel
    .xls application/vnd.ms-excel
    .xls application/x-excel
    .xls application/x-msexcel

    So, there is no guarantee that if we use a method to match to a list for multi upload that we will now match what was done through the single uploader.

    I am going to try something now that could introduce a small margin of error possibility.  Currently I check MIMe type, folder location, and file name to determine if a file is duplicate.  I will remove MIME type checking so it is done ONLY on location and file name.  Will report back if this does it for me.
  20. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 17 Jan 2011 Link to this post

    Hello Chris,

    According to w3, the xls files have content type of application/vnd.ms-excel whereas xlsx files have a application/vnd.openxmlformats-officedocument.spreadsheetml.sheet Mime Type.

    All the best,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  21. Kellie
    Kellie avatar
    29 posts
    Member since:
    Feb 2009

    Posted 16 Mar 2011 Link to this post

    So is this ever going to be resolved?
    [EDIT]
    I can verify this has been resolved in 2011.1.315.35
    Thanks for resolving this Telerik.

    [EDIT]
    ContentType can now be null after uploading. There doesn't seem to be a catch all anymore.
    I tried uploading a wmv file and the ContentType was null. I will post a ticket to Telerik.


    Kellie Harrisson
    Sierra Systems
  22. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 18 Mar 2011 Link to this post

    Hello Kellie,

    Thank you for reporting the issue. We will resolve it for the next latest internal build.

    Greetings,
    Genady Sergeev
    the Telerik team
  23. Michael
    Michael avatar
    17 posts
    Member since:
    Aug 2010

    Posted 24 Apr 2011 Link to this post

    Hello,

    Im having this problem as well.  I haven't tested every filetype but so far uploading a .xlsx or a .docx file with RadAsyncUpload results in the file having ContentType = null.

    When can we expect this to be fixed?   Is this the same problem Kellie is describing?

    I have temporarily applied this fix.  Does this seem like an appropriate fix?

    if (file.ContentType != null)
    {
        document.MIME = file.ContentType;
    }
    else
    {
        if (file.FileName.EndsWith(".docx", StringComparison.InvariantCultureIgnoreCase))
        {
            document.MIME = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
        }
        if (file.FileName.EndsWith(".xlsx", StringComparison.InvariantCultureIgnoreCase))
        {
            document.MIME = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
        }
    }
  24. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 28 Apr 2011 Link to this post

    Hello Michael,

    This problem has already been fixed, so please download the latest internal build and give it a try.

    Regards,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  25. Raji
    Raji avatar
    56 posts
    Member since:
    Jul 2011

    Posted 16 Feb 2012 Link to this post

    Hi Dimitar,

    I am using Telerik.Web.UI.dll(Ver 2010.3.1317.20), IE 7.0 browser, .Net 2.0. I have the same problem. The contenttype is all ways application/octet-stream for any file. What should I do to get the right MIMEType?

    Thanks,
    Raji
  26. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 21 Feb 2012 Link to this post

    Hello Raji,

    The version of the controls that you are using is rather old, we have already fixed the aforementioned issue so you should upgrade if possible.

    All the best,
    Dimitar Terziev
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  27. p
    p avatar
    28 posts
    Member since:
    Sep 2008

    Posted 26 Apr 2013 Link to this post

    Is this still a problem? I get the content type as "application/octet-stream"  when i upload a xls file using IE7 or IE8. My version is "2012.2.724.40"

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