Академический Документы
Профессиональный Документы
Культура Документы
http://domain.com/index.php?title=Main+Page&action=raw
Password Field
<input type="password" name ="pass" />
Radio Buttons
<input type="radio" name="radio1" value="Men" />
<input type="radio" name="radio1" value="Women" />
Checkboxes
<input type="checkbox" name="vehicle" value="Bike" />
Submit Button
<input type="submit" value="Submit" />
Hidden fields
<input type="hidden" name="product_id" value="122" />
POST and GET Variables
Retrieval
Retrieved using PHP's super global arrays
$_GET for variables sent using GET method
$_POST for variables sent using POST method
$_REQUEST for variables sent using GET or
POST
$color = $_GET['color'];
value will be variable
stored here name
$_FILES['upfile']['size']
The size, in bytes, of the uploaded file.
Handling File Upload (2)
$_FILES['upfile']['type']
The mime type of the file, if the browser provided this
information. An example would be "image/gif". This mime
type is however not checked on the PHP side and
therefore don't take its value for granted.
$_FILES['upfile']['tmp_name']
The temporary filename of the file in which the uploaded
file was stored on the server.
$_FILES['upfile']['error']
The error code associated with this file upload.
Handling File Upload
Example
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir .
basename($_FILES['upfile']['name']);
if (move_uploaded_file($_FILES['upfile']['tmp_name'],
$uploadfile)) {
echo "File is valid,
and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
If upload directory is the same as PHP file that handle the file upload, then
you can change the $uploaddir value to "."
Questions?