File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to get the image from external folder?

 
Ganesan Ramakrishnan
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
As i unable to get the image from the external folder . that is when i am accessing my web application with IP address from other system i could not get the image on the screen . i kept that image into outside of the application.

for example
when i am accessing the application in local machine:
this is the url

http://localhost:9080/Fun/index.html

i am getting image .

but not in the below url.
from other's machine

http://192.168.0.21:8090/Fun/index.html

here the image that i access in the screen points to local drive. so it's not coming when accessing from the other's machine with ip.

thanks
Ganesan
 
Vinoth Thirunavukarasu
Ranch Hand
Posts: 164
Android Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Edit: not-so-nice response removed.]
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the URL you're using in the img tag's "src" attribute?
 
Ganesan Ramakrishnan
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the url "D:/img/sample.jpg"
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is a URL to a file on the file system. Do you expect your clients to all have that file there on their own computers?


 
Ananth Chellathurai
Ranch Hand
Posts: 349
Eclipse IDE Hibernate Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use relative paths instead of real paths.

Ananth Chellathurai
 
Ganesan Ramakrishnan
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault :- No, Actually the image folder i kept outside from the application. ie .war file in server path. img folder in outside folder.

Ananth Chellathurai :- i am using real path because of i kept the img folder outside of the application.


Thanks
Ganesan.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ganesan Ramakrishnan wrote:Bear Bibeault :- No, Actually the image folder i kept outside from the application. ie .war file in server path. img folder in outside folder.

My point is that when you use a file path URL like that the browser looks for the file on the local system. Is that what you want? Obviously not.
 
Ganesan Ramakrishnan
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then Is there anyway to access the external files apart from relative path?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. The file either needs to be addressable by a URL, or you'll have to write a servlet that can read the file and serve it.
 
Ganesan Ramakrishnan
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic