0

While downloading any file from the ASP.NET Core 3.1 application, browser should always ask location where to save it?

In the browser we have option namely "Ask where to save each file before downloading" but I want to do it programmatically whenever my application get option on Client Machine.

Dale K
  • 25,246
  • 15
  • 42
  • 71
Incognito218
  • 33
  • 1
  • 9
  • So, you want to override the browser setting and prompt where to save file for each file? This is not possible! – phuzi Nov 25 '20 at 13:40
  • Any particular reason, why it is not possible? – Incognito218 Nov 25 '20 at 13:56
  • Because there's no API available from JS that allows you to do so and this would override the user's preferences. I know that if I tell the browser to save all files to my downloads folder. I wouldn't want a website to be able to prompt me where to save it. – phuzi Nov 25 '20 at 14:01
  • Is there any chance that i can opt where to save the file? Irrespective of touching browser's feature. – Incognito218 Nov 25 '20 at 14:37
  • Nope, only the user can do that. It would open up all sorts of security issues. I'm wondering WHY you want to do this. – phuzi Nov 25 '20 at 14:39
  • Its client requirement that they want a dialogue box which allow them to save file on particular location. – Incognito218 Nov 25 '20 at 14:40
  • Don't believe it can be done! Best they can do is ask all their users to enable prompting where to save file each time. I'm willing to be corrected in my assertion but I don't think it's possible unless it's a desktop app instead of an app running in a browser. – phuzi Nov 25 '20 at 14:46
  • There are a number of questions on SO asking the same, all with the same answer - No. https://stackoverflow.com/questions/42266918/make-the-browser-prompt-for-open-save-the-file-instead-of-downloading-immediatel https://stackoverflow.com/questions/19679842/prompting-user-to-save-file-using-a-save-as-dialog https://stackoverflow.com/questions/38981701/how-to-prompt-save-as-option-for-user-to-download-file-using-chrome https://stackoverflow.com/questions/8405180/prompt-user-to-save-file-to-a-specific-location – phuzi Nov 25 '20 at 14:52
  • I think the best you can do is change the name of the file but no way to force the prompt of where to save the file. – phuzi Nov 25 '20 at 14:54
  • Thanks @phuzi for the prompt help.. – Incognito218 Nov 25 '20 at 15:02
  • No problem, I guess you're going to have to go back to the client and tell them it's not possible. Depends how attached to the idea they are, perhaps ask them for the reasoning behind it, there may be an alternate solution they haven't considered. Good luck. – phuzi Nov 25 '20 at 15:10

0 Answers0