A file path specifies the location of a file inside a web folder structure. It’s like an address of a file that helps the web browser access the files. File paths are used to link external resources such as images, videos, style sheets, JavaScript, displaying other web pages, etc. To insert a file on a web page its source must be known. For example, the syntax (<img src=” ” alt=” “>) is used to insert an image file, where the path of the file is mentioned in the source (src).
File paths are of two types:
Absolute File Paths
Relative File Paths
Absolute File Paths: It describes the full address(URL) to access an internet file
Example:
<img src=”https://code4education/wp-content/uploads/logo.png” alt=”My Image”>
Relative File Path: It describes the path of the file relative to the location of the current web page file.
Example:
<img src=”images/code.jpg” alt=”My Image” style=”width:400px”>