function UploadStartedPdf(sender, args) { var filename = args.get_fileName(); var fileSize = args.get_length(); alert(fileSize); var ext = filename.substring(filename.lastIndexOf(".") + 1); if (ext != 'pdf') { throw { name: "Invalid File Type", level: "Error", message: "Invalid File Type (Only .png)", htmlMessage: "Invalid File Type (Only .png)" } return false; } return true;}
<ajaxtoolkit:AsyncFileUpload ID="AsyncFileUpload" Width="200" runat="server" OnClientUploadError="uploadError" ClientIDMode="AutoID" OnClientUploadStarted="UploadStartedPdf" OnClientUploadComplete="uploadCompletePdf" CompleteBackColor="White" UploaderStyle="Modern" ErrorBackColor="Red" ThrobberID="Throbber" OnUploadedComplete="AsyncFileUpload_UploadedComplete" />
Login to post response