我如何选择我想要保存下载文件的位置? [英] How can I choose the location where I want to save downloaded files?

查看:106
本文介绍了我如何选择我想要保存下载文件的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Groovy下有一个Grail应用程序。我导出一个Excel文件。如果我在代码中提到文件位置,我可以导出文件,但我想让用户在他的PC上选择文件位置。什么是HTML或JavaScript来做到这一点?您有任何代码可以帮助我吗?

谢谢。

解决方案

  response.setHeader(Content-disposition,attachment; filename = book.csv); 
response.setContentType(application / vnd.ms-excel);
response.outputStream<< test.writeToString();


I have a Grail application under Groovy. I export an Excel file. I can export a file if I mention the file location in the code, but I want to keep the user choose file location on his PC. What is HTML or JavaScript to do this? Do you have any code to help me?

Thanks.

解决方案

response.setHeader("Content-disposition", "attachment; filename= book.csv" );
response.setContentType("application/vnd.ms-excel");  
response.outputStream << test.writeToString();

这篇关于我如何选择我想要保存下载文件的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆