downloading a file

S

Sean

Hi all,

I am creating a web application to convert files to a different
format. The interface is simple in that there's a filename control
and a submit buttom. The functionality I'm looking for is for the
user to use the filename control to indicate which file to convert,
then to press submit, the file is then uploaded to the application,
converted, and then the response for the user would be a 'Save file
as..' dialog, and they then can indicate where to save the converted
file. I have got everything working up to the point where I have to
respond with the new file. I can't figure out how to set it up so
that their browser expects to download a file. I would ideally like
to stick the converted file in the Response object but there doesn't
seem to be a function for this. I also wish to avoid placing the file
somewhere else and then replying with a link for them to follow to get
at this file. Is there a clean way to do this?

thanks,
Sean
 
T

Trevor Benedict R

Hi,
Use something like this

context.Response.ContentType = "Application/pdf"
context.Response.ContentType = "Application/msword"
context.Response.ContentType = "Application/x-msexcel"
context.Response.ContentType = "application/octet-stream"

and

If you want this to be downloaded then
context.Response.AddHeader("content-disposition", "attachment;
filename=" & strFileName)

If you want the browser to open it using the default viewer then use
this.
context.Response.AddHeader("content-disposition", "filename=" &
strFileName)


Trevor Benedict R
MCSD

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top