您好,登錄后才能下訂單哦!
<!DOCTYPE=html> <html> <head> <title>文件上傳</title> <meta charset='gb2312' /> <style type="text/css"> td{border:1px #0066ff solid;} table{border-collapse:collapse;} </style> <script> function aa() { alert("deletefile!"); } </script> </head> <body> <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="upfile" /> <br /><br /> <input type="submit" name="submit" value="上傳" /> </form> <br><br><br> <?php if(!empty($_FILES[upfile][name])) { $fileinfo = $_FILES[upfile]; $type = strstr($fileinfo['name'],"."); echo "上傳的文件類型是: ".$type; $path = "./Uploads/".$_FILES["upfile"]["name"]; if(move_uploaded_file($fileinfo['tmp_name'],$path)) { echo "<script>alert('文件上傳成功。');</script>"; } echo "<hr />"; echo "<hr />"; foreach($_FILES['upfile'] as $name=>$value) { echo $name.'='.$value.'<br>'; //echo 'asds'.$value.'<br>'; } echo "<hr />"; } //上傳成功后瀏覽目錄 if(is_dir("uploads/")) { $dir = scandir("uploads/"); echo "<form action='deletefile.php' method='get'>"; echo "<table>"; foreach($dir as $value) if($value!='.' and $value!='..') echo "<tr><td><a href='"."./Uploads/".$value."'>".$value."</a> </td><td> <a href='deletefile.php?name=".$value."' onclick='javascript:return confirm(\"真的要刪除這個文件嗎?\");'>刪除</a> </td>"; echo "</table> "; echo "</form>"; } else { echo "目錄路徑錯誤!"; } ?> <!-- "--> </body> </html>
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。