MauricioTL
MauricioTL

Reputation: 443

It's possible to upload a image which is not located in eclipse project to a jsp

Is there a way to upload an image not located in Eclipse project to a jsp?. I have searched that it is possible if image directory is placed in Application Server but that's not what I want, I would like to use a c:\directory in Windows 7. Please find below the code in jsp file I'm using:

<body>

<h1>Image below:</h1>

<img alt="No Image"     
src="C:/MauricioFiles/Proyectos_JavaEE7/MusicStore/pics/guitar.png"   
width="100" height="100">

</body>

Thank you!!!

Upvotes: 0

Views: 49

Answers (2)

Aninda Bhattacharyya
Aninda Bhattacharyya

Reputation: 1251

The <img src> must refer a public web URL, not a local disk file system path. Your images have to be available by a HTTP request. It's namely the webbrowser who has got to download them, not the webserver who has got to include them somehow.

Upvotes: 1

Christian
Christian

Reputation: 22343

Yes you can upload it. But I think what you want to do is to access the local file without uploading it.

But as JSP says, JavaServer Pages. That means that you need to have all your files uploaded and ready in your server. What you do at the moment is, that you use a file which is on your computer and not inside your Server-directory. But you can't access local files outside of your server-environment.

Upvotes: 1

Related Questions