简体   繁体   中英

Image is not displayed in browser when uploaded to server in ASP.NET

I have a project which works fine in local server.The Project however when uploaded in the real server, runs and shows no error but displays the broken image.The image are in the product folder inside img folder in the webroot.

I inspected the image and provided image path from the root directory and it works but when the image path is taken from inside folders as img/product/image.jpg, it shows broken image.

Any help would be much much appreciated.

EDIT:

I am checking the result with inspect elements. The image tag is as

<img width="100%" src="/img/product/hs6.jpg">

The image hs6.jpg do exists then why won't it get displayed. If i use the image from root, it would display

<img width="100%" src="career.jpg">

The above one is working good.

When i copy the image location it shows http://sajilobazar.com/img/product/l7.jpg .You can check in your browser.

I solved the error last night.There was nothing wrong in the path.I changed the folder name from img to myimg , built the solution and uploaded in the server and now its working good.

The Error i guess was due to use of img as a folder as img is itself a predefined tag or keyword.

If the img directory is at root level than you must refer the images inside it like this: \\img\\product\\image1.jpg. Notice the direction of the "\\" and you must specify one "\\| at the beginning of the src attributre.

<img class="topPicture" src="\Content\Images\top.png">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM