|
Posted by carlton on 11/26/01 11:55
When I run the following page, the foreach ($_POST as $key=>$value)
lists the correct values for MAX_FILE_SIZE and password, but no value
for fupload, why is the requested file not being sent? I have tried it
with Firefox, Opera, IE, and Konqueror. all with the same result.
I am running Mandriva 2006 with Apache 2.0.54
T.I.A.,
Carlton
<html>
<head>
<title>Listing 9.15 A file upload script</title>
</head>
<SCRIPT language="php">
<?php
$file_dir = "/home/carlton/uploads";
$file_url = "http://localhost/uploads";
foreach ($_POST as $key=>$value)
{
print "\$_POST[\"$key\"] == $value<BR> ";
}
if ( isset( $fupload ) )
{
print "path: $fupload<br>";
print "name: $fupload_name<br>\n";
print "size: $fupload_size bytes<br>\n";
print "type: $fupload_type<p>\n\n";
if ( $fupload_type == "image/gif" )
{
copy ( $fupload, "$file_dir/$fupload_name") or die ("Couldn't copy");
print "<img src=\"$file_url/$fupload_name\"><p>\n\n";
}
}
else
{
print"<BOLD>First call to the page</BOLD>";
}
?>
</SCRIPT>
<body>
<form enctype="multipart/form-data" action="" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="51200">
<input type="file" name="fupload"><br>
x<input type="submit" value="Send file!">
</form>
</body>
</html>
Navigation:
[Reply to this message]
|