Situatie
In Perl, CGI(Common Gateway Interface) is a protocol for executing scripts via web requests or in other words we can say it’s a set of rules and standards that define how information is exchanged between the custom script and Web Server.
Uploading a file on the Web Server is done with the use of a File upload Form. This File upload form is created on any text editor available and the form must be saved with .htm or .html extension. Creation of a File Upload form involves the following steps:
Solutie
Pasi de urmat
Step 1: Creating Form element
Firstly, there is a need to create a ‘form’ element
<form action=”/cgi-bin/upload.cgi” method=”post” enctype=”multipart/form-data”>
Step 2: Creating Form fields
Secondly, we need to provide fields for the form. These fields are used to guide the user with the files that need to be uploaded in the form.
e.g. Here, we will provide an Upload field for the user to upload their photos and to provide their Email.
<p>Upload Photo: <input type="file" name="photo" /></p>
<p>Email: <input type="text" name="email_address" /></p>
Step 3: Providing Submit Form button
Third Step is to allow the user to submit all the files uploaded according to the fields given in the form. For that, a submit button is required so that the user can send the form to the Web Server.
<!--using button for sending the form to web server-->
<p><input type="submit" name="Submit" value="Submit Form" /></p>
Leave A Comment?