Knowledge Walls
John Peter
Pune, Maharashtra, India
HTML Form with File Upload Template in HTML of Code Template
29440 Views
File Form HTML Template
<html>
    <head>
        <title></title>
    </head>
    <body>
        <form action="upload" method="post" enctype="multipart/form-data">
            <label for="file_photo">Photo:</label>
            <input type="file" name="file_photo" id="file_photo"><br>
            <input type="submit" value="Upload">
        </form>
    </body>
</html>
Hints 
For file uploading process two things are important.

1) enctype should be multipart/form-data.
2) method type should be post.

input element has the type file which is giving the interaction in the web UI to select the file from the end-user. Some of the below techiniques are needed while using input type:file.
Multiple File Selector Example Template
<html>
    <head>
        <title></title>
    </head>
    <body>
        <form action="upload" method="post" enctype="multipart/form-data">
            <label for="file_photo">Photo:</label>
            <input type="file" name="file_photo" id="file_photo" multiple><br>
            <input type="submit" value="Upload">
        </form>
    </body>
</html>
Accept type in input[type=file]
<html>
    <head>
        <title></title>
    </head>
    <body>
        <form action="upload" method="post" enctype="multipart/form-data">
            <label for="file_photo">Photo:</label>
            <input type="file" name="file_photo" id="file_photo" multiple accept="image/gif, image/jpeg"><br>
            <input type="submit" value="Upload">
        </form>
    </body>
</html>
Next Topics
Next lessons of current book.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details