note 98446 added to function.extract
| From: | Rodrigo at osu1 dot php dot net | Date: | Wed, 16 Jun 2010 04:41:38 +0000 |
| Subject: | note 98446 added to function.extract | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170167@lists.php.net to get a copy of this message | ||
Here's a way to use extract in $_FILES arrays without using register_gloabals on.
I started to use extract a few weeks ago, and my codes hasn't been so clean since then. The use
of the arrays $_POST and $_GET is ok, but one missed doublequote causes a lot of trouble.
Besides I teach PHP in a school, and this function has made my examples easier.
<?php
if(isset($_FILES["file"])){
extract($_FILES);
extract($file);
echo $name."<br>";
echo $tmp_name."<br>";
echo $size."<br>";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="" method="post" enctype="multipart/form-data"
name="form1">
<p>
<input type="file" name="file">
</p>
<p>
<input type="submit" name="Submit" value="Enviar">
</p>
</form>
</body>
</html>
Hope this can help anyone.
----
Server IP: 69.147.83.197
Probable Submitter: 189.140.58.36
----
Manual Page -- http://www.php.net/manual/en/function.extract.php
Edit -- https://master.php.net/note/edit/98446
Del: integrated -- https://master.php.net/note/delete/98446/integrated
Del: useless -- https://master.php.net/note/delete/98446/useless
Del: bad code -- https://master.php.net/note/delete/98446/bad+code
Del: spam -- https://master.php.net/note/delete/98446/spam
Del: non-english -- https://master.php.net/note/delete/98446/non-english
Del: in docs -- https://master.php.net/note/delete/98446/in+docs
Del: other reasons-- https://master.php.net/note/delete/98446
Reject -- https://master.php.net/note/reject/98446
Search -- https://master.php.net/manage/user-notes.php