Re: file upload / no tmp name or size?
| From: | Nick Wilson | Date: | Wed, 01 May 2002 19:49:28 +0000 |
| Subject: | Re: file upload / no tmp name or size? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95573@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
* and then 1LT John W. Holmes declared....
> Say it with me... "Show me the code!" No, louder! Yeah...that's good...
Sorry, i figured it would be something someone would spot immediately.
here is the form....
/* add_teacher_form() */
function add_teacher_form() {
global $teach;
$output=<<<EOF
<h2>Please enter the teachers details</h2>
<form enctype="multipart/form-data"
action="$PHP_SELF?mode=add&action=verify" method="post" >
<input type="hidden" name="MAX_FILE_SIZE" value="3000" />
<p><strong>Name:</strong><br />
<input type="text" name="name" value="$teach->name"
/></p>
<p><strong>Address:</strong><br />
<input type="text" name="address" value="$teach->address"
/></p>
<p><strong>Tel:</strong><br />
<input type="text" name="tel" value="$teach->tel"
/></p>
<p><strong>Fax:</strong><br />
<input type="text" name="fax" value="$teach->fax"
/></p>
<p><strong>Email:</strong><br />
<input type="text" name="email" value="$teach->email"
/></p>
<p><strong>Bio:</strong><br />
<textarea name="bio" cols="40"
rows="5">$teach->bio</textarea></p>
<p><strong>Upload photo:</strong><br />
<input name="userfile" type="file" /></p>
<input type="submit" value="Preview before entering" />
</form>
EOF;
return $output;
}
and this is what I'm testing with:
if($HTTP_POST_FILES) {
foreach($HTTP_POST_FILES['userfile'] as $key => $val) {
print("---- ".$key."----".$val."<br />");
}
print("and here is the userfile -- $userfile");
it displays:
- ----name ---- somepic.jpg
- ----type ---- image/jpg
- ----temp_name ---- none
- ----size ---- 0
and the userfile is --- none
Hope that is a little clearer!
- --
Nick Wilson // www.explodingnet.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
iD8DBQE80EbIHpvrrTa6L5oRAvBEAJ9RC4IzMDO9DreWLXs5WdsGezErxACgkMg3
YvnyL0EViA7KQJGSkTAAk3U=
=D8oD
-----END PGP SIGNATURE-----