Location: PHPKode > projects > Work project > workproject/file_download.php
<?
include ("include_config.inc");
include ("include_profile_name.inc");
include ("include_project_name.inc");
include ("include_log_file.inc");
include ("include_delete_task.inc");
include ("include_delete_project.inc");
include ("include_delete_profile.inc");
include ("include_update_user.inc"); 
include ("include_delete_user.inc");
include ("include_list_user.inc");
include ("include_state_name.inc");
include ("include_user_name.inc");
include ("include_workload_project.inc");
include ("include_dates_project.inc");

if ( isset( $HTTP_COOKIE_VARS[$g_string_cookie] ) ) {
	$g_string_cookie_val         = $HTTP_COOKIE_VARS[$g_string_cookie];
	write_log_user ($filename_log, "Cookie created 1.1: ".$g_string_cookie." -- ".$g_string_cookie_val);
}
if ( isset( $HTTP_COOKIE_VARS[$g_project_cookie] ) ) {
	$g_project_cookie_val        = $HTTP_COOKIE_VARS[$g_project_cookie];
	write_log_user ($filename_log, "Cookie created 2.1: ".$g_project_cookie." -- ".$g_project_cookie_val);
}

/* check the login for user */
login_cookie_check();
?>
<?php
/* connection to the database */
$link= mysql_connect($g_hostname, $g_db_username, $g_db_password) or die("could not connect");
$result = mysql_select_db($g_database_name);

	if ($comment_code == "") {
		$query = "SELECT FILE,FILE_NAME,FILE_TYPE FROM TASK WHERE TASK_CODE=$select_task";

		$rows = mysql_query($query) or $mysql_error = mysql_error();

		$total_rows = mysql_numrows($rows);
		$v_file_name = mysql_result($rows,0,FILE_NAME);
		$v_file = mysql_result($rows,0,FILE);
		$v_file_type = mysql_result($rows,0,FILE_TYPE);	

	} else {
		$query = "SELECT C_FILE,C_FILE_NAME,C_FILE_TYPE FROM COMMENT_TASK WHERE TASK_CODE=$select_task and COMMENT_CODE=$comment_code";

		$rows = mysql_query($query) or $mysql_error = mysql_error();

		$total_rows = mysql_numrows($rows);
		$v_file_name = mysql_result($rows,0,C_FILE_NAME);
		$v_file = mysql_result($rows,0,C_FILE);
		$v_file_type = mysql_result($rows,0,C_FILE_TYPE);	
	}
	
	header( "Content-type: $v_file_type" );
	header( "Content-Length: $g_max_file_size" );
	header( "Content-Disposition: filename=$v_file_name" );
	header( "Content-Description: Download Data" );

	echo $v_file;

?>
Return current item: Work project