Rename File

Discussion in 'ASP .Net' started by shapper, Dec 18, 2007.

  1. shapper

    shapper Guest

    Hello,

    I want to make a file available to a user for download on an ASP.NET
    page.
    So I need to have a button that when clicked, the file is download.
    However, before the file is downloaded, I want it to be renamed so the
    file name that the users gets is different that the one in the server.
    The extension will be the same.

    Any idea of how to do this?

    Thanks,
    Miguel
    shapper, Dec 18, 2007
    #1
    1. Advertising

  2. Hello shapper,

    instead of putting direct link to file on webform, put the linkButton and
    in the codebehind read your file as stream and send it to user
    in this case u can send is with any name

    ---
    WBR,
    Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

    "The greatest danger for most of us is not that our aim is too high and we
    miss it, but that it is too low and we reach it" (c) Michelangelo


    s> Hello,
    s>
    s> I want to make a file available to a user for download on an ASP.NET
    s> page.
    s> So I need to have a button that when clicked, the file is download.
    s> However, before the file is downloaded, I want it to be renamed so
    s> the
    s> file name that the users gets is different that the one in the
    s> server.
    s> The extension will be the same.
    s> Any idea of how to do this?
    s>
    s> Thanks,
    s> Migue
    Michael Nemtsev [MVP], Dec 18, 2007
    #2
    1. Advertising

  3. You will have to write your own aspx that streams file to the browser
    and append following line to header
    Content-disposition: attachment; filename=fname.ext
    See http://support.microsoft.com/kb/260519


    George



    "shapper" <> wrote in message
    news:...
    > Hello,
    >
    > I want to make a file available to a user for download on an ASP.NET
    > page.
    > So I need to have a button that when clicked, the file is download.
    > However, before the file is downloaded, I want it to be renamed so the
    > file name that the users gets is different that the one in the server.
    > The extension will be the same.
    >
    > Any idea of how to do this?
    >
    > Thanks,
    > Miguel
    George Ter-Saakov, Dec 19, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hugz
    Replies:
    3
    Views:
    574
    Harmit Jhajj
    Feb 25, 2004
  2. C-man
    Replies:
    9
    Views:
    632
    Roedy Green
    Apr 11, 2004
  3. Lovell
    Replies:
    2
    Views:
    106
    Jan Svitok
    Jan 14, 2007
  4. Mmcolli00 Mom
    Replies:
    1
    Views:
    160
    Reid Thompson
    Dec 12, 2008
  5. He Who Greets With Fire

    Rename File Using Strring Found in File?

    He Who Greets With Fire, Mar 4, 2008, in forum: Perl Misc
    Replies:
    19
    Views:
    219
    Martijn Lievaart
    Mar 7, 2008
Loading...

Share This Page