check number of files selected

Last post 11-17-2009, 9:22 PM by cutechat. 4 replies.
Sort Posts: Previous Next
  •  11-16-2009, 1:38 AM 57163

    check number of files selected

    Hello
     
    I need to know number of selected files. For example if I am having 19 images maximum limit and first time I have selected 13 images. So I need to know in which variable I will get 13 ?
     
    Please help.
     
    Thanks
  •  11-16-2009, 9:04 PM 57194 in reply to 57163

    Re: check number of files selected

    Hi anki_tinki,

    Add the code below into the page

     <script type="text/javascript">

    var count=0;

    function CuteWebUI_AjaxUploader_OnSelect(files)

       {
     
          count+=files.length;

          alert("you selected "+count+" files");

       }

       </script>

     

      Regards,

     ken

     
  •  11-16-2009, 10:14 PM 57201 in reply to 57163

    Re: check number of files selected

    Hi,
     
    Please also check this sample :
     
    1. <script type="text/javascript">  
    2.     //prevent duplicated items:   
    3.     function CuteWebUI_AjaxUploader_OnSelect(files)   
    4.     {   
    5.         var sames=[];   
    6.         var items=uploader.getitems();   
    7.         for(var i=0;i<files.length;i++)   
    8.         {   
    9.             var file=files[i];   
    10.             var exists=false;   
    11.             for(var j=0;j<items.length;j++)   
    12.             {   
    13.                 var item=items[j];   
    14.                 if(item.FileName==file.FileName)   
    15.                 {   
    16.                     exists=true;   
    17.                 }   
    18.             }   
    19.             if(exists)   
    20.             {   
    21.                 sames.push(file.FileName);   
    22.                 file.Cancel();   
    23.             }   
    24.         }   
    25.         if(sames.length>0)   
    26.         {   
    27.             alert("These file(s) are already in the queue : \r\n\t"+sames.join('\r\n\t'));   
    28.         }   
    29.     }   
    30. </script>  

     
    Regards,
    Terry
     
  •  11-17-2009, 3:48 AM 57206 in reply to 57194

    Re: check number of files selected

    Thanks alot Ken and Terry!
    But I am having another error with IE8. Please help me.
  •  11-17-2009, 9:22 PM 57231 in reply to 57206

    Re: check number of files selected

    Please post the error message.
     
    Regards,
    Terry
View as RSS news feed in XML