jeudi 27 juillet 2017

Downloading file before is ready

I have a button to download a file from a db and writing info on it, but the button download the file before write the info so when I open it it's empty...

I have something like this:

/*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()));

any ideas?




Aucun commentaire:

Enregistrer un commentaire