在这个坑里3个多小时啊。这里不得不抱怨下,国内的资料坑爹,全部copy不说,还是错的。

解决办法:

在服务端加入代码:

   File file = new File(path); //path为要下载的文件路径

response.setContentLengthLong(file.length()); //对应于long getContentLengthLong()或者 int getContentLength()。


 

相关文章:

  • 2021-06-23
  • 2022-12-23
  • 2021-10-15
  • 2022-02-21
  • 2022-01-31
  • 2021-10-10
  • 2022-02-13
  • 2021-07-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2021-07-13
  • 2021-11-13
  • 2021-12-19
相关资源
相似解决方案