Running Red Hat Fedora 1, latest updates. MySQL 3.23.58 PHP 4.3.4 Apache 2.0.48.
Uploaded file info not showing up where it's supposed to. Here's the scenario:


Here is my "form header":
<form enctype="multipart/form-data" action="includes/file.php" method="post">
<input type="hidden" name="usna" value="<?=$usna?>">
<input type="hidden" name="auth" value="<?=$auth?>">
<input type="hidden" name="filid" value="<?=$filid?>">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000">


Here is the input field where it gets the filename:
   <input type=\"file\" name=\"finame\" size=\"27\">

Here is the PHP code that executes this:
if($newfile){
       $uploaddir = "/home/nick/http/homepage/userfiles/";
       $uploadfile = $uploaddir . $_FILES['$finame']['name'];

if(move_uploaded_file($_FILES['$finame']['tmp_name'], $uploadfile)){
$finame = basename($finame);
$sql = mysql_query("INSERT INTO files SET filename='$finame', owner='$fiowner', description='$fidesc'");
}
else{
echo "<p> </p><center><H2>File Upload Failed.</H2></center>";
echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"5;URL=../index.php?index=main.inc&usna=$usna&auth=$auth\">";
}
}


Here is the resulting $_FILE values:
Array ( [finame] => Array ( [name] => brian.txt [type] => text/plain [tmp_name] => /home/nick/dump/phpTFCF0R [error] => 0 [size] => 1627 ) )


Here is the resulting $uploadfile value, and the problem:
   /home/nick/http/homepage/userfiles/

Now, I took this code, as you might recognize parts of it, right from PHP.NET in the part of the manual about "post method uploads". I can't for the life of me figure out why the filename is not being returned to that string. Any thoughts?

Nick

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to