SoFunction
Updated on 2025-03-10

How to not automatically close the page after downloading


<%
// Get the file name and path
String filename = ("filename");
String filepath = "c:\\";

// Set the response header and download saved file name
("APPLICATION/OCTET-STREAM";
("Content-Disposition","attachment; filename=\"" + filename + "\"";

// Open the stream information of the specified file
fileInputStream=new (filepath + filename);

// Write out streaming information
int i;
while ((i=()) != -1) {
(i);
}
();
();
%>
<html>
<head>
<script language=javascript>
()
</script>
</script>
</head>
<body>
</body>
</html>