我一直在使用本网站寻找答案,但我找不到任何可能的帮助,所以我决定创建一个帐户,并问自己。pdf文件下载链接不能在php
这是我正在从事的网站的链接http://www.h-elpsystems.co.uk/index.php。这是一个数据库驱动的网站,允许用户下载文件。现在我正在网站上的一个页面上工作(据我所知,我没有触及任何使用下载代码的代码),现在突然间下载不起作用。
下载地址位于底部的“就业法律页面”。当你点击链接下载一个文件时,它只会将用户发送到同一页面,并且只在末尾的URL中使用#。
我不确定要上传哪一段代码(我是php的新手),但是如果有人会让我知道哪些是需要的,我会上传它。
感谢您提前提供任何帮助。
PS这里是我用来下载的代码。 (注意我没有创建的代码,我只是编辑的两页,在下载似乎已停止出于某种原因的工作。)
<?
// Define the path to file
$file = "membersfiles/".$_GET['ID'];
if(!file)
{
// File doesn't exist, output error
die('file not found');
}
else
{
// Set headers
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$file");
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");
// Read the file from disk
readfile($file);
}
?>
<!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=utf-8" />
<title>Download file</title>
</head>
<body>
</body>
</html>
而且下面是就业页面的代码。 (对不起,我新来这个论坛这样真的不知道在什么的问题包括)
<?
session_start;
include("../Functions.inc");
$ID=PageID(substr(dirname($_SERVER['PHP_SELF']), 1, strlen(dirname($_SERVER['PHP_SELF']))));
?>
<!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><? echo PageTitle($ID);?></title>
<meta name="keywords" content="<? echo PageKeywords($ID);?>" />
<meta name="description" content="<? echo PageDescription($ID);?>" />
<meta name="robots" content="index,follow" />
<link href="../mainstyles.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
<div id="leftcolumn"><div id="mainnav"><img src="../media/logo.gif" alt="H-elp Systems" /><? include("../Left-Links.inc"); ?>
<a href="mailto:[email protected]" id="emailbutton" ><span>click here to email us</span></a>
<img src="../media/navfooter.gif" alt="Help Systems" /></div>
</div>
<div id="centercolumn">
<div id="topnav">
<? include("../Top-Links.inc"); ?>
</div>
<div id="content">
<img src="../media/headers/<? echo PageTitle($ID);?>.jpg" alt="" />
<img src="../media/splashtext/<? echo PageTitle($ID);?>.gif" alt="When it come to employment you need h-elp systems" /><a href="#" id="phonelink" ><span>0121 635 5870</span></a>
<img src="../media/hr450.gif" alt="Help Systems" />
<div id="contentcopy">
<h1><? echo PageSplash($ID);?></h1>
<? echo PageContent($ID);?>
<?
$query = "SELECT * FROM `Files` WHERE `Employment`=1";
$result = mysql_query($query) or die ("Failed To get member files!");
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print("<img src=\"../media/hr450.gif\"/><br><a href=\"#\" onclick=\"javascript:downloadwindow('../Download.php?ID=".$line['URL']."');\">".$line['URL']."</a>");
}
?>
</div>
<img src="../media/hr450.gif" alt="Help Systems" />
<div id="footer">
<p>RJS Management Services Ltd Concorde House Trinity Park Solihull B37 7UQ<br />
Tel.+44 (0)121 635 870 Email. <a href="mailto:[email protected]">[email protected]</a></p>
</div>
</div>
</div>
<div id="rightcolumn">
<?
$query = "SELECT * FROM `News` ORDER BY `Date` DESC limit 0, 4";
$result = mysql_query($query) or die ("Failed To get latest news!");
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$ShortContent=substr($line['Content'],0,175);
print("<h2>".$line['Title']."</h2>".$ShortContent."...<p class=\"small\">".$line['Date']."</p><a href=\"../News.php?Article=".$line['ID']."\" class=\"clickformore\" ><span>click here for more</span></a><img src=\"../media/hr.gif\" alt=\"H-elp\" />");
}
?>
</div>
</div>
</body>
</html>
<?
//Close any open connetions
mysql_close;
?>
编辑:我已经试过了大家的答案,他们似乎以某种形式,但由于某种原因,当工作我将更改后的代码上传到服务器,当我点击就业法网页时,它似乎会出现一个空白页。现在我不知道我是否保存错误或上传错误或者其他错误。
似乎是这个问题的质量太低。 – StasGrin
描述cms,what_have_you_tried和一些代码? – StasGrin
所有下载链接上都有#个标签,您使用了哪些下载代码? –