我不知道为什么会出现以下错误:
Not allowed to load local resource: file:///D:/CargoDocsPDFs/0000024606//NAM3112358.pdf
我正在使用下面的函数创建一个链接到PDF文件的表,用户只需单击即可下载:
<?php
function return401KDocs()
{
$dir = "D:/CargoDocsPDFs/0000024606/";
$ffs = scandir($dir);
echo "<table class='table table-bordered display nowrap'>";
echo "<thead>";
echo "<tr>
<th style='width:300px;'>File Name</th>
<th style='width:100px;'>Upload Date</th>
<th style='width:25px;'>File Size</th>
<th style='width:100px;'>Delete</th>
</tr>";
echo "</thead>";
echo "<tbody>";
foreach($ffs as $ff)
{
if($ff != '.' && $ff != '..' && preg_match('#(pdf|doc|docx|xls|xlsx|PDF)$#',$ff))
{
$filesize = filesize($dir . '/' . $ff);
echo "<tr><td><a download href='$dir/$ff'>$ff</a></td><td>" .
date('m.d.y - g:i A', filemtime($dir . '/' . $ff)) .
"</td><td>" . round(($filesize / 1024), 2) . " kb</td>
<td><a href='#' class='delete401KFile' data-file='".$ff."'>Delete</a></td></tr>";
}
}
echo "</tbody>";
echo "</table>";
}
?>
使用上面的函数可以打印出一个表,可用的文件是用户应该能够单击以下载该文件的链接。但是主题错误消息禁止我。
我找到这个链接:
jQuery Not allowed to load local resource
但我不能使用该链接,因为它与使用Ajax调用有关。我正试图用PHP完成这项任务。