retrieve_by_string_fields(array('id' => $_REQUEST['id'], 'parent_type' => "Emails"))) { die("Not a Valid Entry Point"); } $location = $GLOBALS['sugar_config']['upload_dir']."/" . $_REQUEST['id']; $mime = getimagesize($location); if(!empty($mime)) { header("Content-Type: {$mime['mime']}"); } else { header("Content-Type: image/png"); } readfile($location);