This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
first of all sorry for asking such an easy question , but it is bugging me for a long time..
actually i am building a web application in which user has the ability to upload his images under directory
now these images can be viewed online bcz they are under web-inf...but the problem is i am working on production server and i have to replace the war after some changes or bug fixing. what ever images user has uploaded will be deleted as i replace the war..
if i save these images outside the server then . obviously i cant access them online...only if i copy them back in web-inf again and then give link to user..
can anybody suggest me what should b the suitable solution for this problem-..and i dont want to store images in database.. :-)
Sure you can--stream the images to the user with a servlet (or whatever back-end technology you're using).
Joined: Feb 05, 2010
actually . !
let me explain you the whole scenario...i dont want to save image under
..because i am continuously updating and war file by replacing it..if i store image in image folder then what ever is in that folder will be deleted when i will replace it with the new one.......so what i did, i place images in some other folder say
now i want to show the stored image to the online user in html image tag.....
....as you can understand..the image stored at c:/... cant be shown online.....right ?
so what i am doing is that i am copying the requested image from c:/... to webinf/images. when user need that image to view it....
that might sound bad...
but this was quiet easy to implement...and the servlet approach doesnt fits in the scenario anywhere... ??? perhaps may b i am missing some thing...
Asad Kazmi wrote:and the servlet approach doesnt fits in the scenario anywhere... ??? perhaps may b i am missing some thing...
Again, real words please. And proper punctuation and capitalization. Programming is all about attention to detail and accuracy. Please show the same care in your posts that you would show in your code.
Yes, you are missing something. The servlet can read the image file anywhere off the file system and stream it as the response.