0
I’m having a strange problem: my form works for uploading images but does not work for uploading PDF files.
My code is this:
$titulo = $_POST['txtTitulo'];
$descricao = $_POST['txtDescricao'];
$extension = pathinfo($_FILES['flFile']['name']);
$extension = ".".$extension['extension'];
$extension != '.';
$file = md5(time().rand()).$extension;
$anexo = 'assets/uploads/'.$file;
move_uploaded_file( $_FILES['flFile']['tmp_name'], $anexo );
$query = "insert into tb_arquivos (id_arquivo, titulo, descricao, anexo)
values (null, '".$titulo."', '".$descricao."', '".$anexo."')";
mysql_query($query) or die (mysql_error());
If I insert an image, everything works perfectly. But if I enter a PDF, I lose all form values (including the $title and $description variables.
Can someone help me?
Thank you very much!!!