Click here to Skip to main content
14,635,966 members
Rate this:
Please Sign up or sign in to vote.
See more:
This is my markup

<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" Width="500px" AllowedFileTypes="xls"/>

When I run it, and upload xls files, the page gives no reaction.

But the same works fine for

<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" Width="500px" AllowedFileTypes="png"/>

That is I am unable to upload xls,xlsx,doc,docx etc. But I am able to upload image and pdf files.

And I am able to upload xls,xlsx,doc,docx etc., if I give no AllowedFileTypes. That is

<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" Width="500px"/>

I am unable to figure out what is happening.

Help me ASAP.

Thanks in advance,
Avinaash S
Posted
Updated 16-Jun-14 23:25pm
v3
Comments
Member 10889460 17-Jun-14 5:20am
   
It works fine for docx files if I use the following markup

<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" Width="500px" AllowedFileTypes="doc,vnd.openxmlformats-officedocument.wordprocessingml.document" />

Thanks
Avinaash S
Member 10889460 17-Jun-14 5:36am
   
And the following works for xlsx

<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" Width="500px" AllowedFileTypes="xls,vnd.openxmlformats-officedocument.spreadsheetml.sheet" />

And the following for doc files

<asp:AjaxFileUpload ID="AjaxFileUpload2" runat="server" Width="500px" AllowedFileTypes="doc,msword" />

I used this page for reference
http://filext.com/faq/office-mime-types

Thanks
Avinaash S
Member 10889460 17-Jun-14 5:40am
   
You can use it like this

<asp:AjaxFileUpload ID="AjaxFileUpload2" runat="server" Width="500px" AllowedFileTypes="xls,vnd.ms-excel,xls,vnd.openxmlformats-officedocument.spreadsheetml.sheet,doc,msword,doc,vnd.openxmlformats-officedocument.wordprocessingml.document" />

Thanks
Avinaash S
Rate this:
Please Sign up or sign in to vote.

Solution 1

Hi All,

The issue got resolved.

I used this page for reference
Microsoft Office MIME Types

It works fine for docx files if I use the following markup

<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" Width="500px" AllowedFileTypes="doc,vnd.openxmlformats-officedocument.wordprocessingml.document" />


And the following works for xlsx

<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" Width="500px" AllowedFileTypes="xls,vnd.openxmlformats-officedocument.spreadsheetml.sheet" />

And the following for doc files

<asp:AjaxFileUpload ID="AjaxFileUpload2" runat="server" Width="500px" AllowedFileTypes="doc,msword" />


You can use it like this

<asp:AjaxFileUpload ID="AjaxFileUpload2" runat="server" Width="500px" AllowedFileTypes="xls,vnd.ms-excel,xls,vnd.openxmlformats-officedocument.spreadsheetml.sheet,doc,msword,doc,vnd.openxmlformats-officedocument.wordprocessingml.document" />


Hope this will help some one :)
Thanks and regards
Avinaash S
   
v2
Comments
Member 10889460 17-Jun-14 6:31am
   
The same way you can use

wmv,x-ms-wmv

for wmv

Thanks
Avinaash S
Member 10889460 17-Jun-14 6:37am
   
Even this link was helpful

MIME Types by File Extension

This link contains lot of MIME Types by File Extensions
Rate this:
Please Sign up or sign in to vote.

Solution 2

Quote:
inorder to work on IE Broswer docx and xlsx extension also needs to be added on AllowedFileTypes
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100