나는이 사이트를 사용하여 답변을 찾았지만 도움이 될만한 것은 찾을 수 없으므로 계정을 만들고 스스로에게 물어보기로했습니다.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
모든 다운로드 링크에 # 개의 태그가 있습니까? 어떤 코드를 다운로드하고 있습니까? –