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

File ContentType for .zip file is null

6 Answers 239 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Rakesh
Top achievements
Rank 1
Rakesh asked on 15 Jul 2015, 08:31 PM

Hello All

I am using RadAsyncUpload and using a custom HTTPHandler and inserting the files directly to DB. Before inserting I am checking for the MIME Type of the file. I am getting the MIME type from Uploadedfile.ContentType. This is returning NULL for .zip file.I am using IE 10 and the version of Telerik is 2014.3.1024.35

Any help is much appreciated.

Thanks

Rakesh

6 Answers, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 20 Jul 2015, 07:18 AM
Hi Rakesh,

Are you using Google Chrome? This look like a bug in Chrome. It can be reproduced with the following hmtl:

<!DOCTYPE html>
<head>
    <title></title>
</head>
<body>
    <div>
        Select .zip 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>
</body>
</html>

I have logged this issue to Google - Web API Blob.Type returns empty mime type when zip file is selected. 
But this what is more interesting here is that IE10/11 also returns empty mime type for zip files.

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
0
Rakesh
Top achievements
Rank 1
answered on 20 Jul 2015, 11:00 AM

Hi Hristo

Thank you for the reply. I didn't try it in Chrome. But this is happening in IE10. Looks like you too have the same issue in IE10/11. Do you have any alternative approach for this?

 

Thanks

Rakesh

0
Hristo Valyavicharski
Telerik team
answered on 20 Jul 2015, 11:34 AM
No unfortunatelly. But you could try to get the content type by the file extension.

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
0
Rakesh
Top achievements
Rank 1
answered on 20 Jul 2015, 11:43 AM
I have the extension. But I need the MIME type for some validation.
0
Accepted
Hristo Valyavicharski
Telerik team
answered on 20 Jul 2015, 02:25 PM
Since this is a bug in browser's File API implementation try to disable the AsyncUpload File API module:

<telerik:RadAsyncUpload runat="server" ID="upload" DisablePlugins="true"
      HttpHandlerUrl="~/AsyncHandler.ashx"></telerik:RadAsyncUpload>
<script type="text/javascript">
       Telerik.Web.UI.RadAsyncUpload.Modules.FileApi.isAvailable = function () { return false; }
 
   </script>

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
0
Rakesh
Top achievements
Rank 1
answered on 20 Jul 2015, 02:50 PM

This is working perfect in IE10. I am not sure how this behaves in chrome. Thank you for the help.

 

Thanks

Rakesh

Tags
AsyncUpload
Asked by
Rakesh
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Rakesh
Top achievements
Rank 1
Share this question
or