HighTechTalks DotNet Forums  

Rename File

ASP.net ASP.net discussions (microsoft.public.dotnet.framework.aspnet)


Discuss Rename File in the ASP.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
shapper
 
Posts: n/a

Default Rename File - 12-17-2007 , 09:07 PM






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

Reply With Quote
  #2  
Old   
Michael Nemtsev [MVP]
 
Posts: n/a

Default Re: Rename File - 12-18-2007 , 04:28 AM






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> Miguel



Reply With Quote
  #3  
Old   
George Ter-Saakov
 
Posts: n/a

Default Re: Rename File - 12-19-2007 , 08:53 AM



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" <mdmoura (AT) gmail (DOT) com> wrote

Quote:
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



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.