Re: file uploading
| From: | Jeff Orrok | Date: | Wed, 27 Dec 2000 19:53:24 +0000 |
| Subject: | Re: file uploading | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31996@lists.php.net to get a copy of this message | ||
techzeus@pacific.net.sg wrote:
>
> It would be useful if we can actually see the code ?
Here is http://www.rt.com/~jeff/foo.php3
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Loose//EN">
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo "Hello World<P>\n"; ?>
<?php echo "$HTTP_USER_AGENT\n"; ?>
<!-- ?php phpinfo() ? -->
<form action="foo2.php3" method=post name="testform"
enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value=1048576>
<input type="text" name="userfile">
<input type="submit" value="Upload, Dammit!">
</form>
</body>
</html>
Here is http://www.rt.com/~jeff/foo2.php3
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Loose//EN">
<html>
<head>
<title>PHP Test Result</title>
</head>
<body>
File uploading...
<?php
error_reporting(255);
phpinfo();
echo $HTTP_POST_VARS['userfile']['name'];
echo $HTTP_POST_VARS['userfile']['tmp_name'];
echo $HTTP_POST_VARS['userfile']['type'];
if($userfile<>"none") {
if(!copy($userfile, "/t1/home/jeff/public_html/$userfile_name")) {
echo "couldn't upload :-(";
} else {
echo "got it :-)";
}
} else {
echo "bozo alert!";
}
?>
</body>
</html>
--
J
--