file download

  • Thread starter Thread starter Sharon
  • Start date Start date
S

Sharon

hi all.
i have a page which lets clients download files.
the file are stored in sql server so this is how its done:

Response.BufferOutput = false;
Response.ContentType = "none";
byte[] fileData = (byte[])drUp["fileData"];

Response.BinaryWrite(fileData);
Response.End();

my problem is that i don't know how to set the file name in the Save As...
dialog
and the page name is automatically put into the dialog.

10x
sharon.
 
Use this line:
Response.AddHeader("Content-Disposition","attachment;filename=myfile.doc");
 
thanks steve.
it works perfectly :)

Steve C. Orr said:
Use this line:
Response.AddHeader("Content-Disposition","attachment;filename=myfile.doc");

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com



Sharon said:
hi all.
i have a page which lets clients download files.
the file are stored in sql server so this is how its done:

Response.BufferOutput = false;
Response.ContentType = "none";
byte[] fileData = (byte[])drUp["fileData"];

Response.BinaryWrite(fileData);
Response.End();

my problem is that i don't know how to set the file name in the Save As...
dialog
and the page name is automatically put into the dialog.

10x
sharon.
 
Back
Top