html - Linking images that are in separate folders -


i've been working in friends code, , of images called out as:

<img src="/uploads..."> //the '/' before folder in src isn't allowing me link images. 

i know easy question of you, can't seem images link correctly. have file structure follows:

project folder>two folders (uploads) & (code)  

now, if have html in 'code' folder, , i'm trying link of images in 'uploads' folder, how should restructure files link? i've tried putting html in root under 'project folder' , still doesn't link images in uploads.

the point don't want take out '/' in every src inside html, , hoping structure files link correctly.

if every image link looks this:

/uploads/somefile.ext 

then files being linked going need in folder called uploads in root of web server. above gets translated this:

http://server/uploads/somefile.ext 

no matter url of page is.

in general sort of thing frowned upon because requires website run in root of server/domain/etc. if want website run in sub-folder need change above absolute path relative path:

./uploads/somefile.ext 

that tells browser append link current url "folder" (i use term loosely, idea) of current document. if url of page like:

http://server/somefolder/anotherfolder/index.html 

then image links created relative that:

http://server/somefolder/anotherfolder/uploads/somefile.ext 

in long run, best bet update of links accordingly. absolute paths (what have) should used if there's compelling reason use them. possible, use relative paths.

as quick fix, long uploads folder in root of url domain, should work.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -