To insert a file in 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.
<img src=”https://media.geeksforgeeks.org/wp-content/uploads/geek.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 1: It shows the path of the file present in the same folder of the current web page file.
Example 2: It shows the path of the file present in a folder above the folder of the current web page file. The image file present in a folder called images and current web page file exists inside a sub folder, then the code will be as follows:
Example 3: It shows the path of the file present in a folder which is located at the root of the current sub directories.
- How to set a value to an input file using HTML ?
- HTML | <input type="file">
- How to make PDF file downloadable in HTML link using PHP ?
- How to send data of HTML form directly to JSON file?
- How to fetch data from JSON file and display in HTML table using jQuery ?
- How to reset selected file with input tag file type in Angular 9?
- How to get file input by selected file name without path using jQuery ?
- Johnson’s algorithm for All-pairs shortest paths | Implementation
- Mathematics | Walks, Trails, Paths, Cycles and Circuits in Graph
- How to know which php.ini file is used ?
- PHP | Uploading File
- How to include one CSS file in another?
- How to delete a file using PHP ?
- PHP | php.ini File Configuration
- What is .tpl file in PHP web design?
- Download file from URL using PHP
- Bulma | File
- How to unzip a file using PHP ?
Improved By : Akanksha_Rai