I have the following code snippet that looks for files in the directory:
<?php session_start(); include("../conexao.php"); if(isset($_SESSION['MSLogin']) and isset($_SESSION['MSSenha']) ){} else {header("Location: index.php"); exit; }
$QueryClient = mysql_query("SELECT * FROM clientes WHERE id = '".$_GET["CodigoCliente"]."'");
$Cliente = mysql_fetch_array($QueryClient);
$id = mysql_query("SELECT id FROM clientes WHERE id = '".$_GET["CodigoCliente"]."'");
$IDD = mysql_fetch_array($id);
?>
<h2> Imagens de <? echo $Cliente['nome'];?> </h2>
<style>
body {
background: #FFFFFF;
}
</style>
<script type="text/javascript" src="../FANCYBOX/lib/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#FormClient').submit(function(){
var dados=jQuery(this).serialize();
jQuery('#ResultClientEdit').html("<p align='center'><img src='../FANCYBOX/source/22.GIF'></p>");
jQuery.ajax({
type:"POST",
url:"../administrativo/PC_processar_edicao_clientes.php",
data:dados,
success:function(data){$('#ResultClientEdit').html(data)}
});
return false
})
});
</script>
<?php
$pasta = '../uploads';
if (is_dir($pasta)){
$diretorio = dir($pasta);
while(($arquivo = $diretorio->read()) !== false)
{
echo '<a target="_blanc" href='.$pasta."/".$arquivo.'>'.$arquivo.'</a><br />';
}
$diretorio->close();
}else{
echo 'A pasta não existe.';
}
?>
What's the problem? This search returns all the files in the directory, but I would like to select them by name, since this name always starts with the client id. I hope I was clear, Thanks !!