Hi all,
I am trying to make link to a dynamically generated
zip file which the user can download. It links to a
jsp page like so:
<a href="audio_download.jsp">Download Audio</a>
In audio_download.jsp, I have the following code to
generate the zip:
<jsp:useBean scope="session" id="myLatestAudioFiles"
class="java.util.ArrayList"/>
<%
response.setContentType("application/zip");
if( ! myLatestAudioFiles.isEmpty() )
{
ZipOutputStream ostr = new ZipOutputStream(
response.getOutputStream() );
for(int i = 0; i < myLatestAudioFiles.size();
i++)
{
String file_path =
(String)myLatestAudioFiles.get(i);
String file_name =
CFunctions.splitPathName(file_path)[1];
InputStream istr = new
FileInputStream(file_path);
ostr.putNextEntry( new ZipEntry(file_name)
);
CFunctions.copyStream(istr, ostr);
istr.close();
}
ostr.close();
}
%>
This works but when the user clicks the link, the save
file dialog's default file name is audio_download.jsp.
I want it to be a dynamically generated zip file name
(something like 087_latest_audio.zip). How do I do
that? Or is this the wrong approach?
thanks in advance,
Eugene
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]