initiating a file download via a Button

M

matt

hello,

how does one inititate the dowloading of a file via a button click? for
example, i have a file sitting on the webserver; when the user clicks
on a button, i'd like them to see their web browser's "save this file
to the file system" dialogue and have them download it.

im not even sure if this would be server-side or client-side. either
works for me.

any tips?

thanks!
matt
 
M

matt

....that didnt work for me for some reason.

no sweat tho, i found another way:

//send file to user
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AppendHeader("content-disposition", "attachment; filename=" +
fileName);
Response.Flush();
Response.WriteFile(fileAbPath);
Response.End();

....this has an added advantage of allowing me to use a dynamically
generated filename. cool.


thanks,
matt
 

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,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top