Hi there everyone, I'm trying to get a script that uploads a User specified image file and lets the user edit it with text. It's basically a 'banner' generator that will take in the users image, resize it and include the specified text on a transparent overlay.
<?php
$tmp_name = $_FILES["upload"]["tmp_name"];
echo "\"".$tmp_name."\"";
$name = $_FILES["upload"]["name"];
$webserver = $_SERVER['DOCUMENT_ROOT'];
$fullname = $webserver."/$name";
if (move_uploaded_file($tmp_name, "uploads/$name"))
{
echo "File is valid, and was successfully uploaded.\n";
echo "test number is ";
}
else
{
echo "Possible file upload attack!\n";
}
?>
So far that works and the image gets moved into the uploads folder. However, when I try :
if (move_uploaded_file($tmp_name, "uploads/$name"))
{
if (exif_imagetype("uploads/$name") == IMAGETYPE_GIF)
{
echo "Its a GIF";
}
else
{
echo "its a png";
}
echo "File is valid, and was successfully uploaded.\n";
}
else
{
echo "Possible file upload attack!\n";
}
Nothing happens. It isn't checking the type of image the file is 😕
Any ideas? Thanks in advance