本文介绍了如何使用AjaxFileUpload上传MS Office文件(即xls,xlsx,doc,docx等)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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
推荐答案
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" />
希望这会有所帮助:)
谢谢和问候
Avinaash S
Hope this will help some one :)
Thanks and regards
Avinaash S
引用:
为了在IE上工作Broswer docx和xlsx扩展也需要在AllowedFileTypes上添加
inorder to work on IE Broswer docx and xlsx extension also needs to be added on AllowedFileTypes
这篇关于如何使用AjaxFileUpload上传MS Office文件(即xls,xlsx,doc,docx等)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!