Hi all,
I have managed to make an upload script.
But when i run the script it does not give's an var an value and it does not upload the image.
But along with that i want to change the code so that it only can upload images, i know how to do this but where do i have to put it ??
$check = strToLower($_FILES["foto"]["name"]);
if(eregi("(jpg|jpeg|gif|png)$", $check))
The code:
if ($_FILES['foto']['name'] != "")
{
$ext = explode(".", $_FILES['foto']['name']);
$mix = $onderwerp.$nick;
$filehash=md5($mix);
$_FILES['foto']['name'] = substr($filehash, 0, 15).".".$ext[1];
$tmpfile = "plaatjes/".$_FILES['foto']['name'];
$size = $_FILES['foto']['size'];
if($size <= "200000")
{
if(!file_exists($tmpfile))
{
move_uploaded_file($_FILES['foto']['tmp_name'], $tmpfile);
chmod($tmpfile, 0755);
$fotopad = $tmpfile;
}
else
{
$_FILES['foto']['name'] = substr($filehash, 5, 20).".".$ext[1];
move_uploaded_file($_FILES['foto']['tmp_name'], $tmpfile);
chmod($tmpfile, 0755);
$fotopad = $tmpfile;
}
echo 'Het plaatje is opgeslagen.<br>';
}
else
{
Echo "Je plaatje is te groot: ".$size."/200000 Bytes</font>";
}
}