Support forums
in

Distinct File Uploads

Last post 09-29-2009, 10:00 AM by cutechat. 12 replies.
Sort Posts: Previous Next
  •  08-26-2009, 10:25 AM 55070

    Distinct File Uploads

    Is there a way to prevent the upload queue from having multiple entries of the same file?
     
    how would one do this? 
  •  08-26-2009, 8:12 PM 55083 in reply to 55070

    Re: Distinct File Uploads

    Please check this sample :

    1. <%@ Page Language="C#" Title="First sample" %>  
    2. <%@ Import Namespace="CuteWebUI" %>  
    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. <script runat="server">  
    6.     void InsertMsg(string msg)   
    7.     {   
    8.         ListBoxEvents.Items.Insert(0, msg);   
    9.         ListBoxEvents.SelectedIndex = 0;   
    10.     }   
    11.     protected void UploadAttachments1_AttachmentAdded(object sender, AttachmentItemEventArgs args)   
    12.     {   
    13.         InsertMsg("Added.." + args.Item.FileName);   
    14.     }   
    15. </script>  
    16.   
    17. <html xmlns="http://www.w3.org/1999/xhtml">  
    18. <head id="Head1" runat="server">  
    19. </head>  
    20. <body>  
    21.     <form id="Form1" runat="server">  
    22.         <CuteWebUI:UploadAttachments runat="server" ID="UploadAttachments1" OnAttachmentAdded="UploadAttachments1_AttachmentAdded">  
    23.         </CuteWebUI:UploadAttachments>  
    24.         <br />  
    25.         <div>  
    26.             Server Trace:   
    27.             <br />  
    28.             <asp:ListBox runat="server" ID="ListBoxEvents" Width="800"></asp:ListBox>  
    29.         </div>  
    30.     </form>  
    31.   
    32.     <script type="text/javascript">  
    33.     var lastqueueitems;   
    34.     function CuteWebUI_AjaxUploader_OnQueueUI(files)   
    35.     {   
    36.         lastqueueitems=files;   
    37.     }   
    38.     function CuteWebUI_AjaxUploader_OnSelect(files)   
    39.     {   
    40.         if(!lastqueueitems)return;   
    41.            
    42.         for(var k=0;k<files.length;k++)   
    43.         {   
    44.             var selectedfilename=files[k].FileName;   
    45.                
    46.             for(var i=0;i<lastqueueitems.length;i++)   
    47.                 if(selectedfilename==lastqueueitems[i].FileName)   
    48.                 {   
    49.                     alert("You shall not upload same file twice : "+selectedfilename);   
    50.                     return false;   
    51.                 }   
    52.         }   
    53.     }   
    54.     </script>  
    55.   
    56. </body>  
    57. </html>  

     

    Regards,
    Terry

  •  09-01-2009, 8:12 AM 55237 in reply to 55083

    Re: Distinct File Uploads

    this code works great for canceling a selection which contains a file that is already queued up but it cancels the entire selection including files which have not yet been queued up. is there a way from preventing the queue up of only files that are present and allow the queue up of new files within the same selection?
     
    for example:
    if i have files 1,2,3, and 5 on the queue and then select files 1,2,3,4,and 5. i would like only file 4 to be queued up.
     
     
    can this be done with your control? 
  •  09-01-2009, 8:46 AM 55239 in reply to 55237

    Re: Distinct File Uploads

    Hi,
     
    Currently the AjaxUploader do not provide javascript API to process each files yet.
     
    We will provide that feature in the future, but maybe a long days later.
     
    Regards,
    Terry
  •  09-03-2009, 3:55 AM 55339 in reply to 55239

    Re: Distinct File Uploads

    Hi,
     
    Now you can cancel the item of the Select event.
     
    Please download the last version and try :
     
        function CuteWebUI_AjaxUploader_OnSelect(files)
        {
      var sames=[];
      var items=uploader.getitems();
      for(var i=0;i<files.length;i++)
      {
       var file=files[i];
       var exists=false;
       for(var j=0;j<items.length;j++)
       {
        var item=items[j];
        if(item.FileName==file.FileName)
        {
         exists=true;
        }
       }
       if(exists)
       {
        sames.push(file.FileName);
        file.Cancel();
       }
      }
      if(sames.length>0)
      {
       alert("These file(s) are already in the queue : \r\n\t"+sames.join('\r\n\t'));
      }
        }
     
    Regards,
    Terry
     
  •  09-23-2009, 1:16 PM 55822 in reply to 55339

    Re: Distinct File Uploads

    by new version do you mean 3.0? it says 3.0 came out september of 2008 since we purchased this proiduct only a few months ago i believe we currently have the latest version is this correct?
  •  09-23-2009, 1:44 PM 55823 in reply to 55339

    Re: Distinct File Uploads

    this codes seems to work "kind of". I have two <CuteWebUI:UploadAttachments> controls on the same page for one of the controls the CuteWebUI_AjaxUploader_OnSelect  function is triggered but for the other the one that actually does multiple files uploads it does not.
    Also "uploader" in the provided code I assume refers to the <CuteWebUI:UploadAttachments> control correct?
  •  09-24-2009, 11:35 AM 55856 in reply to 55823

    Re: Distinct File Uploads

    Hi,
     
    last version means 200909XX ( you can check the file property dialog)
     
    Can you post some code to explain your case ?
     
    CuteWebUI_AjaxUploader_OnSelect should trigger to all uploader controls.
      
    Regards,
    Terry
  •  09-24-2009, 3:01 PM 55861 in reply to 55856

    Re: Distinct File Uploads

    I realised why it wasnt triggering and it had somethign to do with my calling of  "uploader.getitems();" this broke. I dont think I have the latest version of the dll. Where can I get the latest version when I go to downloads it says the latest versions is from a year ago
  •  09-24-2009, 3:05 PM 55862 in reply to 55861

    Re: Distinct File Uploads

    also I noticed "uploader.getitems();" was not in the AJAX uploader developer guide "class reference" you have available. when will the new class reference with the updates info be available?
  •  09-26-2009, 9:00 AM 55893 in reply to 55862

    Re: Distinct File Uploads

    Hi,
     
    You can download the last version at http://ajaxuploader.com
     
    Currently the online document is old , we will add the new API list to it soon.
     
    Regards,
    Terry
  •  09-28-2009, 9:32 AM 55916 in reply to 55893

    Re: Distinct File Uploads

    is the "CuteWebUI.AjaxUploader.dll " files provided in the download different in any way? like is the one included in the "advancedCS20" folder different from the one in the "Framework 2.0-Csharp" folder? also how can I find out the version of the dll file?
  •  09-29-2009, 10:00 AM 55936 in reply to 55916

    Re: Distinct File Uploads

    Hi,
     
    They are the same file .
     
    When you want to check the file version , you can open the file property dialog , and check the title of the detail tab.
     
    Regards,
    Terry
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems