Hi!
This is starting to get ridiculous. After the upgrade to 4.5.0d the email attacments gets corrupted. Don't know where to start looking and I need all the help I can get. To start with, where does the attachments get stored on the server?
Here's my downloaf.php. Maby there's something wrong there?
PHP Code:die("Not a Valid Entry Point");
} else {
// cn: bug 8753: current_user's preferred export charset not being honored
$current_user->retrieve($_SESSION['authenticated_user_id']);
$current_language = $_SESSION['authenticated_user_language'];
$app_strings = return_application_language($current_language);
$local_location = $sugar_config['upload_dir']."/".$_REQUEST['id'];
if (!file_exists( $local_location ))
{
die($app_strings['ERR_INVALID_FILE_REFERENCE']);
}
else if (strpos($local_location, "../") || strpos($local_location, "..\\") ) {
die($app_strings['ERR_INVALID_FILE_REFERENCE']);
}
else
{
global $locale;
if (strtolower($_REQUEST['type']) == 'documents'){
$query = "SELECT filename FROM document_revisions WHERE id = '" . $_REQUEST['id'] ."'";
}
else if (strtolower($_REQUEST['type']) == 'notes'){
$query = "SELECT filename FROM notes WHERE id = '" . $_REQUEST['id'] ."'";
}
$rs = $db->query($query);
$row = $db->fetchByAssoc($rs);
if (empty($row)){
die($app_strings['ERR_INVALID_FILE_REFERENCE']);
}
$name = $locale->translateCharset($row['filename'], 'UTF-8', $locale->getExportCharset());
$download_location=$sugar_config['upload_dir']."/".$_REQUEST['id'];
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-type: application/force-download");
header("Content-Length: " . filesize($local_location));
header("Content-disposition: attachment; filename=\"".$name."\";");
header("Pragma: no-cache");
header("Expires: 0");
set_time_limit(0);
ob_start();
if (filesize($local_location) < 2097152) {
readfile($download_location);
}
else {
readfile_chunked($download_location);
}
@ob_flush();
}
}


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks