Bear Bibeault wrote:Using a file path will not work anywhere else but on your computer. Is that what you want?
Sir I am storing image path in mysql database table with an id. To display that image using my jsp it is not working sir(that is working in internet explorer but not in other browsers) what I have to do..
My guess: the "image path" is the file path on the server. This of course is useless on any computer except the server; but if your browser is running on the same machine as the server, a link using the file path might actually work in some browsers.
Bear Bibeault wrote:Then I'm really confused. If the image is in the DB, then why does your code use a file path to show it?
Actually I am storing images in my local drive (that is creating new directory as new File("/root/example").mkdir(); ) and storing images to this newly created folder and storing relative path in data base. So when i want to show images to users by getting their id's I have to fetch path from my database and show related images to user.
Paul Clapham wrote:My guess: the "image path" is the file path on the server. This of course is useless on any computer except the server; but if your browser is running on the same machine as the server, a link using the file path might actually work in some browsers.
Thanks for reply,
Your guess is absolutely correct. In my local system only i was checking if images are displaying correct or not . but it is working only in Internet Explorer but not in other browsers what is the reason for this? and how we avoid that.
Actually I have to upload 18000 images into my sql database if I store all images to Mysql database as Blob type the performance is reduced and It will slow down if we upload other images if required.To avoid this problem I am storing all images into folder and their path's into mysql database table. If there is any alternative way to deal with this problem please reply me as soon as possible...
I still don't really see what the problem is. If the images are part of the web app, then just use the proper HTTP URL (not a file URL) to address them. Otherwise, you'll need to write a servlet to stream them as a response. There are many examples you can search for that do just that.