Saving a file in a specific Directory

C

Chicagoboy27

All I am trying to specify a location for the file to be saved in.
currently I have a process that get the location of the file and then
prompts the user to save it in a directory. I am wondering if it is
possible to specify that directory on their system. Our clients would
have this directory on their system already....

here is the code that I am currently using

Response.ContentType = "application/zip";
Response.AppendHeader("Content-Disposition", "attachment;
filename=myzipfile.zip");
Response.WriteFile(@"C:\somedirectoy\somefile.zip");
Response.Flush();

Thanks in advance
 
C

Chicagoboy27

I guess another question would be is there a way totemporarily override
the default location the browser looks to save things in.?
 
L

Laurent Bugnion

Hi,
I guess another question would be is there a way totemporarily override
the default location the browser looks to save things in.?

No, the default location for the files is purely client-side. The server
cannot specify anything. Actually, this is better this way, or else you
could imagine using that for malicious actions (of course it still
request a user interaction, but users are so naive sometimes...)

Usually, the browser starts by displaying a default location, and later
displays the last location where the user saved a file. Of course it may
vary from browser to browser.

HTH,
Laurent
 
C

Chicagoboy27

Thanks for your reply. That is what I was figuring due to security
reasons. Thanks again for taking the time to answer.
 

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

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top