Hi all,
I have a problem with the header ..
I try to download a file and it give me a header error ..
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\job\connect.php:14) in C:\AppServ\www\job\download.php on line 12
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\job\connect.php:14) in C:\AppServ\www\job\download.php on line 13
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\job\connect.php:14) in C:\AppServ\www\job\download.php on line 14
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\job\connect.php:14) in C:\AppServ\www\job\download.php on line 15
I don't understand how the header already sent ??
This is my download code
<?php
include "connect.php";
$sql = "SELECT * FROM upload WHERE Student_ID=$Student_ID";
$result = @($sql) or die ("could not select");
$data = @mysql_result($result, 0, "file_data");
$name = @mysql_result($result, 0, "file_name");
$size = @mysql_result($result, 0, "file_size");
$type = @mysql_result($result, 0, "file_type");
header('Content-type: $type');
header('Content-length: $size');
header('Content-Disposition: attachment; filename="$name"');
header("Content-Description: PHP Generated Data");
echo $data;
?>
Can anyone help me, please 🙁