Re: Temp Directory

  •  01-25-2011, 9:03 PM

    Re: Temp Directory

    Hi mremigion,
     
    The example below shows you how to remove the files after uploaded in method "UploadCompleted".
     

     
    1. <%@ Page Language="C#" %>  
    2.   
    3. <%@ Import Namespace="CuteWebUI" %>  
    4. <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>  
    5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    6.   
    7. <script runat="server">  
    8.   
    9.     protected void attachment1_UploadCompleted(object sender, UploaderEventArgs[] args)  
    10.     {  
    11.         for (int i = attachment1.Items.Count - 1; i >= 0; i--)  
    12.         {  
    13.             attachment1.Items[i].Remove();  
    14.         }  
    15.     }  
    16.   
    17.     protected void attachment1_FileUploaded(object sender, UploaderEventArgs args)  
    18.     {  
    19.         //save stream or save in physical drive  
    20.         //args.CopyTo("~/photos/"+args.FileName);  
    21.     }  
    22. </script>  
    23.   
    24. <html xmlns="http://www.w3.org/1999/xhtml">  
    25. <head id="Head1" runat="server">  
    26.     <title>Untitled Page</title>  
    27. </head>  
    28. <body>  
    29.     <form id="form1" runat="server">  
    30.         <CuteWebUI:UploadAttachments ID="attachment1" runat="server" OnUploadCompleted="attachment1_UploadCompleted" OnFileUploaded="attachment1_FileUploaded">  
    31.         </CuteWebUI:UploadAttachments>  
    32.     </form>  
    33. </body>  
    34. </html> 
     
    Regards,
     
    Ken
View Complete Thread