我已经设置了一个ajaxToolkit:AjaxFileUpload控件,这在上传图像文件时就像一个魅力,但在选择一个MOV文件时,它失败并出现以下错误
[例外:不允许使用文件扩展名。] AjaxControlToolkit.AjaxFileUploadHelper.Process(HttpContext context)+604 AjaxControlToolkit.AjaxFileUploadHandler.ProcessRequest(HttpContext context)+180 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+812 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)+132 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously)+73
上传时调用的URL如下
http://localhost:59486/AjaxFileUploadHandler.axd?contextKey= {DA8BEDC8-B952-4d5d-8CC2-59FE922E2923}&安培;控件ID = ContentPlaceHolder1_AjaxFileUpload1&安培; FILEID = 5F30E222-9559-18CF-EFEB-3B1A29EE91B5&安培;文件名= IMG_3946.MOV&安培;分块=真安培; firstChunk =真
上传jpg时调用的URL如下所示
http://localhost:59486/AjaxFileUploadHandler.axd?contextKey= {DA8BEDC8-B952-4d5d-8CC2-59FE922E2923}&安培;控件ID = ContentPlaceHolder1_AjaxFileUpload1&安培; FILEID = A58166B8-1515-FBB6-5474-600038099117&安培;文件名= Kauslunde%20Fodbold%20-%20Oldboys.jpg&安培;分块=真安培; firstChunk =真
如何解决此问题? 如果我将.mov文件更改为.mov.jpg,我可以毫无问题地上传文件。 那么如何判断应该允许MOV文件呢?
标记如下
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" OnUploadComplete="AjaxFileUpload1_UploadComplete" runat="server" ValidateRequestMode="Disabled" ChunkSize="100" />
答案 0 :(得分:1)
解决方案是在web.config
中添加additionalUploadFileExtensions <configSections>
<section name="ajaxControlToolkit" type="AjaxControlToolkit.AjaxControlToolkitConfigSection, AjaxControlToolkit" requirePermission="false"/>
</configSections>
<ajaxControlToolkit additionalUploadFileExtensions="mov" />