0
I have the following code snippet that searches 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 big deal? This search brings me back all the files from the directory You would like to select them by name, since that name always starts with the client id. I hope I’ve been clear, Thank you!!
It was bad guy, it could be that I’m still doing something wrong, but when I get this piece of code, it doesn’t bring any results, I made several modifications trying to make it work but it didn’t work. have another idea or suggestion ?
– Akashi
Put the
pattern
thus:$pattern = '/' . $_GET["CodigoCliente"] . '/';
?– Thiago Magalhães
I put yes, but nothing returns
– Akashi
I showed you the test that I did. If it’s not working, I believe either the variable
pattern
is not receiving the string with the client code, or the variable$arquivo
is not receiving the string that contains the code that is in$pattern
.– Thiago Magalhães