StephanM
StephanM

Reputation: 753

ASPX C# How do I download Files where the user wants them?

I am trying to develop a web page which will allow users to download to the Directory of there Choice. In my search to find away to do this, I had found that you can't use "FolderBrowserDialog". I am also finding that the examples online will only search the websrver directeory path and not the local machine. Is there anyway to get the Directory Path? I have the code to FTP the File Down, I just have to replace the code for "FolderBrowserDialog".

Upvotes: 0

Views: 1709

Answers (3)

Shyju
Shyju

Reputation: 218952

Browsers wont usually let you to choose location for individual download. you can change your browser settings to update the download folder. If you want to have this in your webpage, you probably need to have an activex control. this activex control can show the directories in the client machine so that user can select those. You need to write code to download the file to that location using the WebClient.DownloadFile method.

http://msdn.microsoft.com/en-us/library/ez801hhe.aspx

Don't expect this activex control works with all your users.Browsers usually block activex control or prompt the user (if the setting is like that).

Upvotes: 0

axel_c
axel_c

Reputation: 6816

In a web application you can't arbitrarily read or write stuff on the user's computer. That would be a gaping security hole, so it just can't be done. The 'Save As' dialog is something that happens entirely client-side. Your control over the download process ends as soon as you set the MIME type and send the file data away.

Upvotes: 0

Andrew Barrett
Andrew Barrett

Reputation: 19911

This isn't really up to you as a website, it's really the browsers job to store where they want files downloaded to. There is a pretty necessary separation between the website and client machine going on here.

Upvotes: 6

Related Questions