> Hello,
>
[quoted text clipped - 12 lines]
>
> Wojtek Stanczuk
The webserver solution is the best one IMO, however, if you want a
tomcat based solution, then you'd have to read the uploaded files in
the servlet/action, after persist them on the file system (which I
believe you're doing currently). However, to render them, read them
back from that location and write the output on the response. That
location can be a preference/property for the application.
Something like:
byte[] bytes =
FileUtils.readFileToByteArray(your_file_as_java_io_File); //Apache
Commons IO
response.setHeader("Content-Disposition", "attachment; filename=
\""+name_of_the_file+"\"");
response.setContentLength(bytes.length);
response.setContentType(resolve_content_type_based_on_extension);
response.getOutputStream().write(bytes);
response.getOutputStream().flush();
response.getOutputStream().close();
However, I find Apache+PHP much better for this kind of thing :)
-cheers,
Manish