Ciao, grazie per la risposta.
Ho già provato ma niente. Il codice è il seguente:
[ CODE]
<%@ page import="java.util.*,java.io.*"%>
<%
//Legge il nome del file
File f = new File ("C:" + request.getAttribute("name") );
//Setto il contentType in base al tipo di file
response.setContentType ("application/zip");
//Setto l'intestazione e il nome che verrà mostrato all'utente
String name = f.getName().substring(f.getName().lastIndexOf("/") + 1,f.getName().length());
response.setHeader ("Content-Disposition", "attachment; filename=\""+name+"\"");
//Apro un InputStream sul file e metto il contenuto nell'OutputStream verso il client
InputStream in = new FileInputStream(f);
ServletOutputStream outs = response.getOutputStream();
int bit = 256;
try {
while ((bit) >= 0) {
bit = in.read();
outs.write(bit);
}
} catch (IOException ioe) {
ioe.printStackTrace(System.out);
}
outs.flush();
outs.close();
in.close();
%>
[/ CODE]
Il problema può stare in response? Non l'ho mai usato in questa applicazione web.
Ciao a Grazie

Rispondi quotando