Remove button does not work properly

Last post 06-05-2012, 9:55 AM by hamed415. 3 replies.
Sort Posts: Previous Next
  •  06-04-2012, 10:09 AM 73817

    Remove button does not work properly

    Hi,
     
       I am using the CuteWebUI:UploadAttachments to upload multiple files.
     
    On uploading there is no problem but on removing a file, it is not consistent. sometimes it works and sometime it doesn't.
    the functions DeleteAttachment(index) and DeleteAllAttachment()
     
    I have added the required permission to the UploaderTemp folder as IUSR, NETWORK SERVICE, IIS_IUSR (full control).
     
    any help would be appreciated.
     
    Thanks
    Filed under:
  •  06-04-2012, 3:32 PM 73822 in reply to 73817

    Re: Remove button does not work properly

    I did a work around and used the Items[Index].Remove() function instead of Delete()
    and handled the deletion of all old Temp files on another event by System FileInfo delete function.
     
    It works for me now but I still want to know why it does not work with DeleteAttachment(Index) and DeleteAllAttachments()?
  •  06-05-2012, 7:36 AM 73827 in reply to 73822

    Re: Remove button does not work properly

    Hi hamed415,
     
    Both methods works fine for me.  Below is my test example page. Does it work for you?
     
    Can you show me how you used these methods  ? So I can check it for you. 
    1. <%@ Page Language="C#" %>  
    2.   
    3. <%@ Register Assembly="CuteWebUI.AjaxUploader" Namespace="CuteWebUI" TagPrefix="CuteWebUI" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    5.   
    6. <script runat="server">  
    7.     protected void btnDelete_Click(object sender, EventArgs e)  
    8.     {  
    9.         for (int i = uploader1.Items.Count - 1; i >= 0; i--)  
    10.         {  
    11.             uploader1.DeleteAttachment(i);  
    12.         }  
    13.     }  
    14. </script>  
    15.   
    16. <html xmlns="http://www.w3.org/1999/xhtml">  
    17. <head id="Head1" runat="server">  
    18.     <title>example</title>  
    19. </head>  
    20. <body>  
    21.     <form id="form1" runat="server">  
    22.         <CuteWebUI:UploadAttachments ID="uploader1" runat="server" TempDirectory="tempFiles">  
    23.         </CuteWebUI:UploadAttachments>  
    24.         <br />  
    25.         <asp:Button ID="btnDelete" runat="server" Text="remove" OnClick="btnDelete_Click" />  
    26.     </form>  
    27. </body>  
    28. </html>  
    Regards,
     
    Ken 
  •  06-05-2012, 9:55 AM 73834 in reply to 73827

    Re: Remove button does not work properly

    Hi Kenneth,
     
       The problem is from client side. On serevr everything is fine. As I said I gave full permission to the Temp folder, but on client side, sometimes you have to click 3 or 4 times till the file gets removed.
     
     
    Thanks
    Hamed
View as RSS news feed in XML