Hello,
Can someone tell me what I am missing? I have looked at a ton of tutorials about retrieving images as an image instead of binary from a file.
I have verified the image goes into the file perfect.
Thanks in advance
<?PHP
require_once('common.php');
session_start();
startFormHeader();
$name = $_FILES['userfile']['name'];
// validate uploaded file
$size = $FILES['userfile']['size'];
$tempFile = $FILES['userfile']['tmp_name'];
if ($userfile=='none')
{
echo "Problem: no file uploaded";
exit;
}
if ($size==0)
{
echo "Problem: uploaded file is zero length";
exit;
}
if (!is_uploaded_file($userfile))
{
echo "problem: possible file upload attack";
exit;
}
$upfile ='showVehicle/'.$userfile_name;
$copy = copy($_FILES['userfile']['tmp_name'],"showVehicle/".$name);
if(!$copy)
echo "System error: was not able to load image";
else
echo"File uploaded successfully<br><br>";
// Pull image from file
$grab = "showVehicle/".$name;
$fp = fopen($grab, "rb");
$contents = fread($fp, filesize($grab));
fclose($fp);
footer();
?>