[英]show the contents of a folder in a web page
我正在嘗試建立一個類似於Google雲端硬盤的在線存儲網站。 我的代碼可以上傳文件並將其保存在指定的給定路徑中。 它還具有用於創建文件的代碼。 唯一缺少的是顯示用戶在特定路徑中上載的用戶“多少”或“哪些”文件。
如Google驅動器圖片所示(在下面的鏈接中),我希望代碼看起來像這樣,我希望用戶在網頁上以串行方式查看他/她上傳的文件。 我不確定如何做到這一點,或者不確定是否可以在php中使用,或者不確定是否可以在php中使用,那么需要哪個功能。 我也不確定Google搜索中的“輸入內容”以找到此類編碼的一些示例。 請告訴我任何可以幫助我啟動項目這一部分的內容。
(我仍在離線工作。我尚未在線啟動它。)
如果您需要我現有工作中的任何代碼,請告訴我。 我想上傳我的代碼。
- -謝謝。
因此,您可以在上傳(保存/移動文件)時將記錄插入數據庫中。
您沒有提供任何示例偽代碼將是:
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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.