I changed it all to this :
if ($_FILES["avatar"] != " ")
{
$ext = explode(".", $_FILES["avatar"]["name"]);
$filehash=md5($_FILES["avatar"]["name"]);
$_FILES["avatar"]["name"] = substr($filehash, 0, 10).".".$ext[1];
$tmpfile = "images/avatars/".$_FILES["avatar"]["name"];
$size = $_FILES["avatar"]["size"];
if($size <= "20000")
{
if(!file_exists($tmpfile))
{
move_uploaded_file($_FILES['avatar']['tmp_name'], $tmpfile);
chmod($tmpfile, 0755);
$avat_pad = $tmpfile;
}
else
{
$_FILES["avatar"]["name"] = substr($filehash, 5, 15).".".$ext[1];
move_uploaded_file($_FILES['avatar']['tmp_name'], $tmpfile);
chmod($tmpfile, 0755);
$avat_pad = $tmpfile;
}
echo 'De avatar is opgeslagen.<br>';
}
else
{
Echo "Je avatar is te groot: ".$size."/20000 Bytes</font>";
}
}
But this outputs:
Warning: chmod(): Unable to access images/avatars/d41d8cd98f. in /home/virtual/site15/fst/var/www/html/register.php on line 313
Warning: chmod(): No such file or directory in /home/virtual/site15/fst/var/www/html/register.php on line 313
lol i think it's doing what you said but what can i do about that ?