User specified download location

前端 未结 1 557
栀梦
栀梦 2021-01-19 22:01

I\'ve been looking about for a while now and I cant find a proper answer.

Basically I have a web page that lets the user enter somevalues and download a specific fil

相关标签:
1条回答
  • 2021-01-19 22:31

    Whether the browser asks the user or not is down to the user's preferences in the browser. You can't bypass those preferences (nor, really, should you — if the user wants to always download files to a specified location, they should be allowed to do that).

    What you can do is make sure you're sending the browser as much information as possible to help it make for a good user experience. If you're not already doing so (you probably are), be sure to include a Content-Disposition header in the response to the download request, including a filename field:

    Content-Disposition: attachment; filename=foo.csv
    

    But I'm guessing you're already doing that part.

    0 讨论(0)
提交回复
热议问题