<form id="browserform" action="browser.php" method="post">
<?php
$rootpath='';
if(isset($_POST['rootpath']))
$rootpath=$_POST['rootpath'];
?>
<input type="text" id="rootpath" name="rootpath" value="<?php echo $rootpath;?>" />
<?php
$handle=opendir($rootpath);
if($handle!=null)
while (false !== ($entry = readdir($handle))) {
if(is_dir($rootpath."/".$entry))
echo "<a href='#' onclick='opendir(\"$entry\")'>$entry</a><br>";
else
echo "<a href='#' onclick='openfile(\"$entry\")'>$entry</a><br>";
}
?>
</form>
<script type="text/javascript">
function opendir(dir)
{
if(dir=="..")
{
var path=document.getElementById("rootpath").value;
var arr=path.split("/");
path=arr[0];
for(var i=1;i<arr.length-1;i++)
path+="/"+arr[i];
document.getElementById("rootpath").value=path;
browserform.submit();
}
else
{
document.getElementById("rootpath").value+="/"+dir;
browserform.submit();
}
}
function openfile(dir)
{
var path=document.getElementById("rootpath").value;
window.open("player.php?path="+path+"/"+dir);
}
</script>
Diretórios
- Instalação/Configuração
- Constantes pré-definidas
- Funções de Diretórios
- chdir — Muda o diretório
- chroot — Muda o diretório raiz (root)
- closedir — Fecha o manipulador do diretório
- dir — Retorna uma instância da classe Diretório
- getcwd — Obtém o diretório atual
- opendir — Abre um manipulador de diretório
- readdir — Lê os campos do manipulador do diretório
- rewinddir — Voltar (rewind) o manipulador de diretório
- scandir — Lista os arquivos e diretórios que estão no caminho especificado
User Contributed Notes
Diretórios
Diretórios
amal250 at gmail dot com
28-Mar-2012 03:41
28-Mar-2012 03:41

dio_write