获取文件URL架构 [英] Get file url schema
本文介绍了获取文件URL架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我知道路径时,如何向用户显示存储在网站服务器上的先前上传的文件(我知道上传的文件应存储在其他服务器上)?解释;在我的代码下面,我在一个元素内创建了一个按钮,我试图通过将相关的url放入元素中来向用户显示相关文件,以向用户显示相关文件,从而向用户显示他们需要查看的文件.
How do I show the user a previously uploaded file that is stored on the website's server (I am aware uploaded files should be stored on a different server) when I know the path? To explain; below in my code I have created a button inside an element and I am trying to get it to display the relevant file to the user by putting the relevant url in the element shows the user the file they need to see.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Total </title>
<link type="text/css" rel="stylesheet" href="course.css">
<script src="../jquery.js"></script>
<script src="../jquery-ui.js"></script>
</head>
<body>
<?php
if ($handle = opendir('../uploads'))
{
while (false !== ($entry = readdir($handle)))
{
if ($entry != "." && $entry != "..")
{
$real=realpath("../uploads/".$entry);
echo "<button class='files accordian'>$entry $real</button>
<div class='panel'>
<p>$real</p>";
echo '<a href="WHAT WOULD GO IN HERE?"><button class="current-file" name="sent" value="View-Current-File"><img class="view-file-img" src="../images/magnify.png">View Current File</button></a>';
}
}
}
?>
</body>
</html>
推荐答案
我认为这对您来说应该足够了,
I think this should be enough for you,
echo '<a href="../uploads/'.$entry.'">
<button class="current-file" name="sent" value="View-Current-File">
<img class="view-file-img" src="../images/magnify.png">View Current File
</button>
</a>';
这篇关于获取文件URL架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文