user2206127
user2206127

Reputation: 47

Adding Image in html

I cannot seem to add an image in html. I'm using ASP.net MVC 3. My image, named KeyLargoPic, is located on a flash drive in the folder X:\Project\Project\Photos\Key Largo, and it appears to be a JPEG. The code is as follows:

<td><img src="X:\Project\Project\Photos\Key Largo\KeyLargoPic.jpg" alt="IMAGE" /></td>

Every time the page loads, it shows the box with "IMAGE" inside. Does anyone know what I'm doing wrong?

Upvotes: 0

Views: 397

Answers (3)

doreye01
doreye01

Reputation: 500

Add the image to your project, probably in the content directory, by right clicking the directory and clicking "Add" then "Existing Item", browse to your jpeg and click "Add". With your image now part of the project you can add it to the webpage like so:

<td><img src="@Url.Content("~/Content/KeyLargoPic.jpg")" alt="IMAGE"></td>

Upvotes: 0

fmgp
fmgp

Reputation: 1636

Try to mount a virtual directory in IIS pointing to X:\Project[...] so you will be able to access your ressources with a relative address

Upvotes: 1

TGH
TGH

Reputation: 39248

Upload the image to your web server and reference via web path from your project. The web server can't read from your usb drive.

Upvotes: 3

Related Questions