that works. thanks. Eugene
--- Darren Govoni <[EMAIL PROTECTED]> wrote: > Try this. I used it for JNLP, but it should work for > zip. Just > replace .jnlp with .zip > > String fileName = request.getServletPath(); > fileName = > fileName.substring(fileName.lastIndexOf("/") + 1); > fileName = fileName.substring(0, > fileName.indexOf(".")) + ".jnlp"; > response.addHeader("Content-Disposition", "Inline; > fileName=" + > fileName); > > > On Sun, 2005-03-06 at 13:27 -0800, Dr NoName wrote: > > > 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] > __________________________________ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]