When downloading a file to a client, how can I inform the client of the file size, so it can predict how long it will take?

Donatello Parigino

You must set the Content-length HTTP header.

You can use the following code:

response.setHeader("Content-disposition", "attachment;filename=name");
response.setIntHeader("Content-length", filelength);
ServletOutputStream sos = response.getOutputStream();
...
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact