Hi:
Thanks, I still can't seem to get it to work. I checked, the directory does exist.
Do you mean that I should just add
copy($userfile[tmp_name],$upfile)
Or do you mean that I should replace:
$upfile = "/home/whyknotbeads/www/" . $userfile[tmp_name];
with
copy($userfile[tmp_name],$upfile)
This is the error I got:
Array ( [userfile] => Array ( [name] => spiderman.gif [type] => image/gif [tmp_name] => /tmp/phpLGDTtE [error] => 0 [size] => 108923 ) )
Warning: copy(/home/whyknotbeads/www//): failed to open stream: Is a directory in /home/whyknotbeads/www/admin/work2.php on line 39
Problem: Could not move file into directory
Thanks!
-t
<html>
<body>
<?php
print_r ($_FILES);
if ($userfile=="none")
{echo "Problem: no file uploaded";
$error = "1";
exit;
}
if ($_FILES['userfile']['size']==0)
{
echo "Problem: uploaded file is zero length";
$error = '1';
exit;
}
if ($_FILES['userfile']['type'] != "image/gif")
{
echo "Problem: file is not an image";
$error = "1";
exit;
}
if (!is_uploaded_file($userfile))
{
echo "Problem: possible file upload attack";
$error = "1";
exit;
}
$upfile = "/home/whyknotbeads/www/" . $userfile[tmp_name];
// I also replaced the previous line with this, but got the same error: copy($userfile[tmp_name],$upfile);
if ( !copy($userfile[tmp_name], $upfile))
{
echo "Problem: Could not move file into directory";
exit;
}
if ($error)
{
echo "Error";
}
else
{
echo "Thank you! Information has been updated.\n";
echo "<script language=javascript>window.location.replace(\"http://www.whyknotbeads.com/admin/test.php?note='Thank you! Information has been updated.'\")</script>";
}
?>