Support forums
in

Temp Directory

Last post 01-27-2011, 3:55 PM by mremigio. 6 replies.
Sort Posts: Previous Next
  •  01-25-2011, 2:57 PM 65875

    Temp Directory

    Hi:
     
    In my web.config I commented out:

    <!--<add key="CuteWebUI.AjaxUploader.TempDirectory" value="C:\\temp\\UploaderTemp"/>-->

    and did not get an error.  Also, I was still able to access file stream.  Is AJAX Uploader saving to another directory?
     
    Thanks
     
    Mila

    MRemigio
  •  01-25-2011, 3:38 PM 65876 in reply to 65875

    Re: Temp Directory

    Dear mremigio,
     
    If you don't explicitly  set the temporary directory, Ajax Uploader will use "C:\Windows\Temp\AjaxUploaderTemp" as the temporary directory. 
    Please use the .CopyTo or .MoveTo method to copy or move the uploaded files. 
              void Uploader_FileUploaded(object sender, UploaderEventArgs args)
            {
                Uploader uploader = (Uploader)sender;
                InsertMsg("File uploaded! " + args.FileName + ", " + args.FileSize + " bytes.");
                
                //Copies the uploaded file to a new location.
                //args.CopyTo("c:\\temp\\"+args.FileName);
                //You can also open the uploaded file's data stream.
                //System.IO.Stream data = args.OpenStream();
            }
     
    Thank you for asking
  •  01-25-2011, 5:01 PM 65877 in reply to 65876

    Re: Temp Directory

    Hi Eric:
     
    Thanks for you response.
     
    BTW, is there anyway to intercept the file stream and prevent the AJAXUploader from persisting the file onto the physical drive?
     
    Thanks
     
    Mila

    MRemigio
  •  01-25-2011, 9:03 PM 65880 in reply to 65877

    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
  •  01-26-2011, 10:20 AM 65894 in reply to 65880

    Re: Temp Directory

    Hi Eric:
     
    Thanks for your response.
     
    I was wondering if there is a way to bypass having to explicitly remove the files from the physical drive.
    The reason is we don't want to our webserver's disk space to be fragmented.
     
    Is there a way to intercept the filestream directly?
     
    Thanks again,
     
    Mila

    MRemigio
  •  01-26-2011, 11:08 PM 65903 in reply to 65894

    Re: Temp Directory

    hi mremigio,
     
    For now does not support this feature. Sorry for your inconvenience.
     
    Regards,
     
    ken
  •  01-27-2011, 3:55 PM 65922 in reply to 65903

    Re: Temp Directory

    Thanks Ken

    MRemigio
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems