Tenth chapter (1) file Upload (i)
I. Submission of the form:
The array that receives common form information is: $_get $_post $_request< cannot determine how forms are received >
The functions that receive file upload information are: $_files
The form cannot have the same name when you do multiple forms of uploading files at the same time.
If you want to do file upload <form> form must be added:
1.method= "POST"
2.enctype= "Multipart/form-data"
3. To add: <input type= "hidden" name= "max_file_size" value= "100000" >
Two. The operation of the file:
Text file type:
text/html. html. htm
Text/plain. txt. log
Image picture Type:
Image/gif. gif
Image/jpeg. jpeg. jpg
Image/png. png
Audio Voice Type:
Audio/x-midi Mid. Midi, mid
Audio/x-wav. wav
Video/quicktime. qt. mov
Video/mpeg. mpeg
Application file Type:
Application/pdf. pdf
Application/msword. doc Dot
Application/vnd.ms-excel. xls
Application/vnd.ms-powerpoint. ppt
Application/zip. zip
Application/rar. rar
Application/xml. Xml. Xsl
Application/mshelp. hlp. CHM
Application/octet-stream. ext. bin. com. dll. class
Is_uploaded_file (the target file name) determines whether the file is uploaded as a function.
Move_uploaded_file (1. destination file name 2. Location name to move to) the function to move the uploaded file to the new location.
Tenth chapter (3) Upload multiple files and file download processing
Continue: Used in a loop structure to skip the remaining code in this loop and start the next loop.
For more information, see PHP video.
The following elements are primarily included in an HTML form:
button Normal button radio checkbox select Drop-down menu text single-line text box textrea multiple text box submit submit button Reset Refill button
The tags commonly used in HTML design forms are tags such as:<form>,<input>,<option>,<select>,<textarea> and <isindex>.
1.<form> form Tags: the main role of the tag is to set the beginning and end of the form and to specify the file name or URL address of the processing form data program, the basic syntax structure of which is: <form action=url method=get|post name= Value onreset=function onsubmit=function target=window> </form>
Action: Used to set the address of the URL of the processing form data program, which is usually a CGI application, using action= "mailto: Your email address" when using email.
Method: Specifies the way data is transferred to the server in two main ways: when Method=get, the input data is passed to the server after the address specified by the action, and when Method=post, The input data is transferred to the server in the form of post transmission in the HTTP transport protocol, in this manner when receiving user information in e-mail.
Name: is used to set the names of the forms.
Onrest and onsubmit: primarily for the reset and submit buttons, they set the subroutine to execute after the corresponding button is pressed.
Target: Specifies which window the input data results are displayed in, and needs to be used with <frame> tags.
2.<input> Form Input Tags: this tag is used frequently in forms, most form content needs to be used with this tag, and the syntax is: <inpur aligh=left|right|middle|top|bottom name=value Type=text|textarea|password|checkbox|radio|submit|reset|file|hidden|image|button Value=value Src=url Checked Maxlength=n size=n onclick=function onselect=function>
Align: The position used to set the form is left, on the right, in the middle (middle), up (top), down (bottom).
Name: Sets the current variable names.
Type: Determines the types of input data, which means:
Type=text: Represents the input single-line text.
Type=textarea: Indicates that multiple lines of text are entered.
Type=password: Indicates that the entered data is a password and is indicated by an asterisk.
Type=checkbox: Oh, the game is a check box.
Type=radio: Represents a Radio box.
Type=submit: Represents the Submit button, and the data is sent to the server.
Type=reset: Clears form data for re-entry.
Type=file: represents inserting a file.
Type=hidden: Represents a hidden button.
Type=image: Represents inserting a picture.
Type=bueeon: Represents a normal button.
Value: Used to set the input default value, that is, if the user does not input, the default value is used.
SRC: is for the Type=image case, for setting the address of the image file.
Checked: Indicates that this item is selected by default in the selection box.
MaxLength: Represents the maximum number of input characters when entering a single line of text.
Size: Used to set the maximum number of characters to enter when entering multiple lines of text, using the Width,height method.
OnClick: Indicates that the specified subroutine is invoked when input is pressed.
Onselect: Indicates that the specified subroutine is invoked when the current item is selected.
3.<select> drop-down menu marker: With <select> tag you can insert a drop-down menu in a table that you want to use with <option>, because each option for a drop-down menu is defined with a <option> tag. The syntax of the <select> tag is: <select name=nametext size=n multiple>
Name: Sets the names of the Drop-down menus.
Size: Sets the height of the menu box, which shows several menu items at a time, the general default value (size= "1").
Multiple: Set to allow multiple selections.
4.<option> option marker: This is marked as an option in the Drop-down menu whose syntax is: <option delected value=value>
Selected: Indicates that the current item is selected by default.
Value: Indicates that the item's corresponding value is sent to the server for processing after the item is selected.
5.<textarea> multiple-line text input tag: This is a special tag that creates a multiline text input box with the syntax: <textarea name=name cols=n rows=n wrap=off|hard|soft>
Name: text box names.
Clos: Width.
Rows: height. (Number of rows)
Wrap: Line change control.
OFF: Do not wrap automatically.
Hard: Automatic hard return line, line marking together to be sent to the server.
Soft: Automatic soft return line wrap, line marking will not be transferred to the server.
Database