If you want to allow a user to upload an external file to your website, you need to use a file upload box, also known as a file select box. This is also created using the <input> element but type attribute is set to file.
Example
You can try to run the following code to upload an external file to your website −
<!DOCTYPE html> <html> <head> <title>File Upload</title> </head> <body> <form> <input type = "file" name = "upload" accept = "image/*" /> </form> </body> </html>
Here are the attributes of the file upload box −
Sr.No | Attribute & Description |
1 | name Used to give a name to the control which is sent to the server to be recognized and get the value |
2 | accept Specifies the types of files that the server accepts. |