PHP: File upload works for images but does not work for PDF files

0

I have a strange problem: my form works for uploading images but does not work for uploading PDF files.

My code is as follows:

$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 insert a PDF, I lose all form values (including those of the $ title and $ description variables.)

Can anyone help me?

Thank you very much!

    
asked by anonymous 25.06.2018 / 14:04

1 answer

0

I discovered that the problem was at the limit of uploading files.

As the images I usually upload to the site are smaller than 2MB, the problem never occurred.

To solve this problem I created an .htaccess file in the project root with the following content:

php_value upload_max_filesize 1G
php_value post_max_size 1G
    
25.06.2018 / 14:29