显示网页中文件夹的内容


show the contents of a folder in a web page

我正在尝试建立一个类似谷歌硬盘的在线存储网站。我的代码可以上传文件并将其保存在特定的给定路径中。它还有用于创建文件的代码。唯一缺少的是向用户显示他/她在特定路径中上传了"多少"或"哪些"文件。

如谷歌硬盘图片所示(在下面的链接中),我希望我的代码看起来与此类似,我希望用户在网页上看到他/她上传的序列文件。我不知道如何做到这一点,也不知道在php中是否可能,或者如果在php中可能,那么需要哪个函数。我也不确定在谷歌搜索中"键入什么"来找到这种类型编码的一些例子。请告诉我任何能帮助我开始这部分项目的事情。

http://www.google.com.bd/imgres?sa=X&biw=1024&bih=605&tbm=isch&tbnid=kSX8G1DGHuYiHM:&imgrefurl=http://www.zdnet.com/blog/networking/free-storage-for-you-google-drive-to-arrive-today/2293&docid=VGLnSQuNf4vGLM&imgurl=http://www.zdnet.com/i/story/62/58/002293/google-drive.png&w=1012&h=725&ei=JPCNUtj_FoKtrAfYkoHwCA&缩放=1&ved=1t:3588,r:12,s:0,i:122&iact=rc&page=2&tbnh=173&tbnw=241&开始=8&ndsp=14&tx=182&ty=107

(我仍在离线工作。我尚未在线启动它。)
如果你需要我现有工作中的任何代码,请告诉我。我很乐意上传我的代码。

---谢谢。

因此,您可以在上传(保存/移动文件)时在数据库中插入记录。

而您没有提供的伪代码示例是:

if (checkForErrors()) {
    // your error page for file exists, improper extension, and other violated constraints
} else {
    move_uploaded_file($_FILES['file']['tmp_name'], 'your/path/here/' . $_FILES['file']['name']);
    $db->query("INSERT INTO uploads (uploader, filename, uploaded_on) VALUES ('{$_SESSION['username']}', '{$_FILES['file']['name']}', NOW());");
}
// later you can just fetch the results for the current uploaded
$db->query("SELECT filename, uploaded_on FROM uploads WHERE uploader = '{$_SESSION['username']}';");
// under the row of filename will be stored the files that the current user has uploaded