I need help to develop a code to store images in the database, so far I have not achieved anything ... I do not know if it is better to store the file in a directory and only the name in the bd, and mainly how do this ...
<form method="post" enctype="multipart/form-data" action="cadastrar.php">
<table>
<tr><td>imagem:</td><td><input type="file" size="60" name="arq" value=""></td></tr>
</table>
</form>
$arq_name = $_FILES['arq']['name']; //nome do arquivo
$arq_size = $_FILES['arq']['size']; //tamanho do arquivo
$arq_tmp = $_FILES['arq']['tmp_name']; //nome temporário do arquivo
//grava no DB
mysql_query("INSERT INTO users (foto) VALUES ('$arq_name')");
//grava a img no diretório
move_uploaded_file($arq_tmp, "imagens/".$arq_name);
Now I just have to be able to get the images by id ...