woshitanke 2014-09-13 10:26
浏览 2472

Response 下载文件 怎么取得默认路径

代码如下:

response.setContentType(contentType);

response.setHeader("Content-disposition", "attachment; filename="

  • new String(realName.getBytes("utf-8"), "ISO8859-1"));

response.setHeader("Content-Length", String.valueOf(fileLength));

bis = new BufferedInputStream(new FileInputStream(downLoadPath));

bos = new BufferedOutputStream(response.getOutputStream());

byte[] buff = new byte[2048];

int bytesRead;

while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {

bos.write(buff, 0, bytesRead);

}

bis.close();

bos.close();

此方法可直接下载文件到客户端,但是我现在不知道改怎样获取 下载到了客户端的什么位置。

我现在不需要设置路径。只需要取得默认下载到的路径。

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料