代码之家  ›  专栏  ›  技术社区  ›  Pedro Joaquín

下载文件之前已准备就绪[关闭]

  •  -1
  • Pedro Joaquín  · 技术社区  · 9 年前

    /*taking blob from database and saved on a folder*/
    
    File f = new File("file name");
    for (int i = 0; i < datos.size(); i++) {
        /*write on the file*/
    }
    
    
    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", f.getName()));
    

    1 回复  |  直到 9 年前
        1
  •  0
  •   Pedro Joaquín    9 年前