Live Support, Chat, Upload Control and Rich Text Editor
Welcome to Support forums Sign in | Join | Help |Client Center
in Search

FileName of downloaded file

Last post 09-18-2009, 12:48 PM by gBurgur. 3 replies.
Sort Posts: Previous Next
  •  09-16-2009, 10:30 AM 55685

    FileName of downloaded file

    When the file gets downloaded to the temp directory, is there anyway to get that filename since it is not the "pure" filename.
    Filed under:
  •  09-16-2009, 11:51 AM 55690 in reply to 55685

    Re: FileName of downloaded file

    You can use args.FileName property to get the file name of the uploaded files.
    Here is an example:
    1. <%@ Page Language="C#" %>  
    2. <script runat="server">  
    3.     void Uploader_FileUploaded(object sender, UploaderEventArgs args)   
    4.     {   
    5.         Uploader uploader = (Uploader)sender;   
    6.         //Copys the uploaded file to a new location.   
    7.         //args.CopyTo("c:\\temp\\"+args.FileName);   
    8.     }   
    9. </script>  
    11. <html>  
    12. <head>  
    13. </head>  
    14. <body>  
    15.     <form id="form1" runat="server">  
    16.        <CuteWebUI:Uploader runat="server" ID="Uploader1" OnFileUploaded="Uploader_FileUploaded"></CuteWebUI:Uploader>  
    17.     </form>  
    18. </body>  
    19. </html> Chat
    Web Messenger: wysiwyg editor:
    asp wysiwyg html editor: Image Gallery:
    Live Support:

  •  09-16-2009, 2:49 PM 55697 in reply to 55690

    Re: FileName of downloaded file

    I went throught the API and realize the "true" filename is args.FileName
    but that is not what I am asking.

        A user uploads a file  "temp1.xml".
        but in the temporary download folder it is called:
    Before I can copy the file to the destination folder,
    I have to make sure the destination folder doesn't contain
    a file called "temp1.xml".

    If another file already has a name of "temp1.xml" in the destination folder,
    I need to rename the newly downloaded file:
        temp1_001.xml   <<< notice the "_001"

    Without the temporary filename of

        I need to copy the file using
        and then rename the file to temp1_001.xml
        and then again copy it to the true destination folder.

    Instead of doing a double-copy just to rename the file to "*_001.xml",
        I would like to rename the file myself from:
        and then copy it to the destination folder.
    It means a single file copy instead of the double file copy.

    Thus, I need someway to get the filename called:
        but I do not see anything in the API about that.

    Is there anyway to get that filename? (persisted.630f0c11-2cc1-4a77-ba91-0b177f23772b.temp1.xml.resx)
    Filed under:
  •  09-18-2009, 12:48 PM 55741 in reply to 55685

    Re: FileName of downloaded file

    Kenneth at CuteSoft emailed me the answer directly so I am posting it here.
     Response.Write("persisted." + args.FileGuid + ".resx");
    and in vb.Net  
    Dim sHoldthis As String = "persisted." + args.FileGuid.ToString + ".resx"   
    If you look at the property directly in the Property Viewer,
    args.FileGuid =Nothing
    so for whatever reason, it has to be directly in the code to 
    retrieve the value.

    Thanks Kenneth
View as RSS news feed in XML
Powered by ASP.Net
Copyright 2003 - 2017 CuteSoft Components Inc.. All rights reserved.