Location: PHPKode > projects > Operational Information > opinfo-1.2/download_publication.php
<?php
if(isset($_GET['download_publication_id'])) 
	{
	$download_publication_id = $_GET['download_publication_id'];

	include("settings.php");

	$con = mysql_connect($database_hostname, $database_username, $database_password);
	mysql_select_db($database_name, $con);
	
	$table_name_publication = $database_table_prefix . "_op_publication";
	$query = "
		SELECT name, type, size, content 
		FROM $table_name_publication 
		WHERE id = '$download_publication_id'
		";
	$result = mysql_query($query) or die("Error, query failed when trying to open publication file with ID $download_publication_id");
	list($name, $type, $size, $content) = mysql_fetch_array($result);
	
	header("Content-length: $size");
	header("Content-type: $type");
	header("Content-Disposition: attachment; filename=$name");
	echo $content;

	mysql_close($con);
	
	exit;
	}
?>
Return current item: Operational Information