Re: Display alret when user tries upload file/s with a same name that already exist in DB

  •  01-28-2013, 12:01 PM

    Re: Display alret when user tries upload file/s with a same name that already exist in DB

    Hi,

     

    Please try the example below, you can achieve it in "function myqueueuihandler(list)".

     

    1. <%@ Page Language="C#" Title="Customize the queue UI" %>  
    2.   
    3. <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">  
    5.   
    6. <html xmlns="http://www.w3.org/1999/xhtml">  
    7. <head id="Head1" runat="server">  
    8. </head>  
    9. <body>  
    10.     <form id="Form1" runat="server">  
    11.         <CuteWebUI:Uploader ID="Uploader1" runat="server" MultipleFilesUpload="true">  
    12.         </CuteWebUI:Uploader>  
    13.     </form>  
    14. </body>  
    15.   
    16. <script>  
    17.   
    18. var uploader=document.getElementById("<%=Uploader1.ClientID %>");  
    19.   
    20. uploader.handlequeueui=myqueueuihandler;  
    21.   
    22. function myqueueuihandler(list)  
    23.   
    24. {  
    25.    for(var i=0;i<list.length;i++)  
    26.        {  
    27.           var name=list[i].FileName  
    28.           //you can check the file name here, if the file already exists '  list[i].Cancel();' will cancel this file  
    29.         
    30.               if(name=="1.gif")  
    31.            //Your code may be 'if(Service1.IsFileAlreadyUploaded(name));'  
    32.              {  
    33.               list[i].Cancel();  
    34.               }  
    35.         }  
    36.  }  
    37. </script>  
    38.   
    39. </html>  

    Regards,

     

    Ken 

View Complete Thread