You are here:   HomeHTML LanguageHTML TutorialHTML MARQUEE
by Dinesh Thakur Category: HTML

HTML also supports a special input field, a file field, to allow visitors to upload files. If you want visitors to submit information - say a picture, a spreadsheet, a word-processed document or a scanned document, they can use this field to simply upload the file with the hassle of using FTP or e-mail the file.

 

Syntax

 

<INPUT type = “file" name = "field-id" size = “n" accept = “file-type" >

 

Name: To label the field




Size: To specify the physical size of the field's input box.

Accept: To restrict the file types allowed in a file upload. For example add accept = "image/ gif" to occupy only gif files

To include files of some specific types, just separate them by commas. For example to include BOTH .gif and .jpeg files, the following code can be used.

Accept = “image/gif, image/jpeg "

When the form is loaded or reset, a button labeled "Browse" together with a text box for writing the file name appears on the window. As the user clicks on this button a new window “choose file” will open and the user can select the desired file. The following code will add a file field.

 

<HTML>

<HEAD><TITLE> TEXT FIELDS</TITLE></HEAD>

<BODY BGCOLOR="PINK">

<P ALIGN ="CENTER"><B>ADMISSION FORM</B>

<FORM>

<P>

<INPUT TYPE ="TEXT" NAME="NAME" VALUE="ENTER YOUR NAME:" SIZE="25" MAXLENGTH="30"> NAME<BR><BR>

<INPUT TYPE ="PASSWORD" NAME="PASSWD" SIZE="25" MAXLENGTH="30"><BR><BR>

<INPUT TYPE ="TEXT" NAME="ADDRESS" SIZE="25" MAXLENGTH="30">

ADDRESS<BR><BR>

<INPUT TYPE=”RADIO” NAME=”SEX” VALUE=”MALE” CHECKED>MALE<BR>

<INPUT TYPE=”RADIO” NAME=”SEX” VALUE=”FEMALE” >FEMALE<BR>

<SELECT NAME =”COUNTRY”>

<OPTION VALUE = “INDIA”>INDIA

<OPTION VALUE = “AMERICA”> AMERICA

<OPTION VALUE = “AUSTRALIA”> AUSTRALIA

<OPTION VALUE = “NEW ZEALAND”> NEW ZEALAND

<OPTION VALUE = “CHINA”> CHINA

</SELECT><B>COUNTRY</B>

<TEXTAREA NAME="COMMENTS" ROWS=2 COLS=20 WRAP="VIRTUAL:”> PLACE YOUR COMMENTS HERE: </TEXTAREA> <B> COMMENTS </B>

<INPUT TYPE=”FILE” NAME =”ATTACHEMENTS” SIZE=”30” ACCEPT=”IMAGE/JPG”> <B> ATTACHEMENTS</B>

<P ALIGN=CENTER>

<INPUT TYPE=”IMAGE” SRC=”C:\WINDOWS\HLPGLOBE.GIF” ALT=”SUBMIT” WIDTH = 55 HEIGHT = 40>

<INPUT TYPE=”RESET” VALUE=”RESET”>

</FORM>

</BODY>

</HTML>





About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.



What's New and Popular





Search Content







Advance Courses



Basic Courses



Advertise with Us