-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Akash,
On 9/2/2009 1:32 AM, asingla4 wrote: > I have my Web application installed in C:\Tomcat\webapp\ROOT. > Now, through the Web page of this application, the user uploads an image > which the application saves in C:\files folder using ImageIO class of JAVA. Aah, the magic of using an image API to save byte streams. You didn't need that extra CPU time for anything, did you? > Now as soon as the file is uploaded, there should be a download button > enabled for this uploaded image. > If the user hits download, he should be able to download the file he > uploaded. Okay, so you want to allow remote clients to access uploaded files through a URL pattern. No problem. > I'm done with saving the file to C:\files but I don't know how to make it > downloadable when the download button is clicked because the files folder is > outside the webapp directory. You have a few options: 1. Create a new context called, say, "files" and point it at c:\files. You can do this by creating CATALINA_BASE/conf/[servicename]/[hostname]/files.xml with this content: <Context docBase="C:\files" /> OR 2. Write a servlet mapped to /files/* (or whatever) that looks-up files in /files and just streams them to the client. #2 would be better if you need to be logged-in to your webapp in order to download files. #1 is more convenient because you don't have to write any code. Hope that helps, - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkqgMAEACgkQ9CaO5/Lv0PBHrQCfdqj0/q0jQPpmhevbuqEblM/b rf8An2cq0u6UPUzRs20h/5xLestYqDSw =8D0G -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org