0
I am trying to make a database for personal use that is to upload boleto and then voucher, but I do not know what I am doing wrong because in Mysql there is only a binary file and not the photo or pdf I put.
And it also follows code
<?php
require 'banco.php';
$vencimento = $_POST['vencimento'];
$empresa = $_POST['empresa'];
$produto = $_POST['produto'];
$descricao = $_POST['descricao'];
$valor = $_POST['valor'];
$pagamento = $_POST['pagamento'];
$banco = $_POST['banco'];
$arq = $_FILES['arq']['name'];
$com = $_FILES['comp']['name'];
$pastaboleto = 'Contas/_images/_boletos/';
$pastacomp = 'Contas/_images/_comprovantes/';
$nomeboleto = $pastaboleto . $arq;
$nomecomprovante = $pastacomp . $com;
$pdo = Banco::conectar();
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "INSERT INTO `indececontas` (`vencimento`, `empresa`, `produto`, `descricao`, `valor`, `pagamento`, `banco`, `arquivo`, `comprovante`) VALUES ('$vencimento', '$empresa', '$produto', '$descricao', '$valor', '$pagamento', '$banco', '$arq', '$com')";
$q = $pdo->prepare($sql);
$q->execute(array($vencimento,$empresa,$produto,$descricao,$valor, $pagamento, $banco));
move_uploaded_file($_FILES['arq']['tmp_name'], $nomeboleto);
move_uploaded_file($_FILES['comp']['tmp_name'], $nomecomprovante);
Banco::desconectar();
header("Location: index.php");?>
It is in LONGBLOB. In this case, it stores the file path and not the file. But when inserted in phpmyadmin, it stores in binary. Which type should I use to store files?
– LuDi Carvalho
so LONGBLOB is byte type, you want to save a string, switch to scan. so I recommended for a suffix, not to have overwrite when saving in Fs.
– Gerardo Junior
I switched and he is still only putting the name of the file... The file itself is not sending.
– LuDi Carvalho
ready, now you should check which are the permissions of the folder in which you want to save.
– Gerardo Junior