0
Response.AddHeader("content-disposition", "attachment;filename=abc.xls");
Response.ContentType = "application/excel";

I am using the code above to download an Excel file but I want to download the Excel file to a specific path.

How can I do this?

Damon
  • 3,004
  • 7
  • 24
  • 28

2 Answers2

1

It is impossible. Server can't to locate client machine for particular destanation of downloading.

RFC 2183:

The receiving MUA SHOULD NOT respect any directory path information that may seem to be present in the filename parameter. The filename should be treated as a terminal component only. Portable specification of directory paths might possibly be done in the future via a separate Content-Disposition parameter, but no provision is made for it in this draft.

Community
  • 1
  • 1
Alexander Myshov
  • 2,881
  • 2
  • 20
  • 31
  • It is possible only on client-side due security reasons. For more information you can check this http://stackoverflow.com/questions/13235709/set-file-download-destination-using-extjs – Alexander Myshov Dec 07 '13 at 05:44
0

It can't be done by server side it's your os and browser settins which tells where the downloaded file should be placed as Alexgender says

"The filename should be treated as terminal component only"