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=”http://contribute.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 the current sub directories.
- Johnson’s algorithm for All-pairs shortest paths | Implementation
- Mathematics | Walks, Trails, Paths, Cycles and Circuits in Graph
- How to include one CSS file in another?
- PHP | Uploading File
- Perl | Appending to a File
- Perl | Writing to a File
- jQuery | :file Selector
- Perl | File Locking
- What is the best way to include CSS file? Why use @import?
- How to log errors and warnings into a file in php?
- Perl | File Test Operators
- file command in Linux with examples
- Different ways to import csv file in Pandas
- Perl | Opening and Reading a File
- Convert byte array to File using Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.