<?php
global $table;
global $act;
global $upload;
if(!isset($_SESSION))
{
session_start();
}
include('db_connection.php');
if(isset($_POST['choose_lang']))
{
$table = $_POST['choose_lang'];
}
if(isset($_POST['action']))
{
$act = $_POST['action'];
}
if(isset($_GET['upload']))
{
$upload = $_GET['upload'];
}
$upload = $_GET['upload'];
$_SESSION['upload'] = $upload;
$table = $_SESSION['choose_lang'];
$act=$_SESSION['action'];
$query = "SELECT * FROM $table WHERE upload = '".$_SESSION['upload']."' AND category = '$act'" ;
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_BOTH);
$size = $row['filesize1'];
$type = $row['filetype1'];
$name =$row['filexml'];
$text = $row['data1'];
header("Content-length:".$size);
header("Content-type:".$type);
header("Content-Transfer-Encoding: Binary");
header("Content-Disposition: attachment; filename=".$name);
readfile("$text");
echo $text;
?>
下载时我的输出应包含以下内容:
File type = "ooTextFile"
Object class = "TextGrid"
xmin = 0
xmax = 2.264331065759637
tiers? <exists>
size = 1
item []:
item [1]:
class = "IntervalTier"
name = "vowels"
xmin = 0
xmax = 2.264331065759637
intervals: size = 5
intervals [1]:
xmin = 0
xmax = 0.9286507897337561
text = ""
intervals [2]:
xmin = 0.9286507897337561
xmax = 1.0970767840615319
text = "a"
intervals [3]:
xmin = 1.0970767840615319
xmax = 1.2213912084463185
text = ""
intervals [4]:
xmin = 1.2213912084463185
xmax = 1.447964272244398
text = "e"
intervals [5]:
xmin = 1.447964272244398
xmax = 2.264331065759637
text = ""
打开时,输出就像记事本文件一样:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
File type = "ooTextFile"
Object class = "TextGrid"
xmin = 0
xmax = 2.264331065759637
tiers? <exists>
size = 1
item []:
item [1]:
class = "IntervalTier"
name = "vowels"
xmin = 0
xmax = 2.264331065759637
intervals: size = 5
intervals [1]:
xmin = 0
xmax = 0.9286507897337561
text = ""
intervals [2]:
xmin = 0.9286507897337561
xmax = 1.0970767840615319
text = "a"
intervals [3]:
xmin = 1.0970767840615319
xmax = 1.2213912084463185
text = ""
intervals [4]:
xmin = 1.2213912084463185
xmax = 1.447964272244398
text = "e"
intervals [5]:
xmin = 1.447964272244398
xmax = 2.264331065759637
text = ""
因此我的文件被破坏了。错误是什么。请帮助!!!!来自HTML Body Comes的地方。