2016-10-18 68 views
0

我在我的webform中使用Ajax控件工具包中的AjaxFilUpload。如果文件大小超過一定大小,我想檢查文件大小並取消上傳。我已經在OnClientUploadStart & OnClientUploadComplete中試過了,但是這樣做後文件仍然顯示在頁面上上傳。AjaxFileUpload cancelUpload()不起作用

網絡表單:

<div> 
    <ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" runat="server" OnUploadComplete="AjaxFileUpload1_UploadComplete" OnUploadStart="AjaxFileUpload1_UploadStart" 
    OnClientUploadCompleteAll="onUploadCompleteAll" OnClientUploadComplete="onUploadComplete" OnClientUploadStart="onUploadStart" /> 
</div> 

的Javascript:

function onUploadStart(sender, args) { 
    sender.cancelUpload(); 
} 

function onUploadComplete(sender, args) { 
    sender.cancelUpload(); 
} 

Web.config文件:

<handlers> 
    <add name="AjaxFileUploadHandler" verb="*" 
    path="AjaxFileUploadHandler.axd" 
    type="AjaxControlToolkit.AjaxFileUploadHandler, 
     AjaxControlToolkit"/> 
</handlers> 

,我該怎樣取消上傳嗎?

回答