我一直在使用本網站尋找答案,但我找不到任何可能的幫助,所以我決定創建一個帳戶,並問自己。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
所有下載鏈接上都有#個標籤,您使用了哪些下載代碼? –