Append pdf greater than 2mb












0














the file storage is limited to 2mb. I've already tried everything, as shown in this https://kinsta.com/blog/wordpress-maximum-upload-file-size/ and I can not increase the file upload limit size.
I leave here the code I'm using to see if it's possible to increase the size of the upload within the php code:



$Valencia = $_POST["Valencia"];
$dataInicio = $_POST["dataInicio"];
$dataFim = $_POST["dataFim"];
$pathToSave = "/var/www/html/wordpress/wp-content/themes/busiprof/Upload/";

/*Checa se a pasta existe - caso negativo ele cria*/
if (!file_exists($pathToSave)) {
mkdir("$pathToSave", 0777);
}

if ($_FILES) { // Verificando se existe o envio de arquivos.

if ($_FILES['txtArquivo']) { // Verifica se o campo não está vazio.
$dir = $pathToSave; // Diretório que vai receber o arquivo.
$tmpName = $_FILES['txtArquivo']['tmp_name']; // Recebe o arquivo temporário.

$name = $_FILES['txtArquivo']['name']; // Recebe o nome do arquivo.
preg_match_all('/.[a-zA-Z0-9]+/', $name, $extensao);
if (!in_array(strtolower(current(end($extensao))), array('.txt', '.pdf', '.doc', '.xls', '.xlms'))) {
echo('Permitido apenas arquivos doc,xls,pdf e txt.');

die;
}

// move_uploaded_file( $arqTemporário, $nomeDoArquivo )
if (move_uploaded_file($tmpName, $dir.$name)) { // move_uploaded_file irá realizar o envio do arquivo.
echo('Arquivo adicionado com sucesso.');
} else {
echo('Erro ao adicionar arquivo.');
}

$conn->query("INSERT INTO UploadPDF (Valencia,dataInicio,dataFim,txtArquivo) VALUES ('$Valencia','$dataInicio','$dataFim','$name')");
}
}


if attach a pdf of 15 mb directly in wordpress, the pdf is attached, but if it is by the above code, it inserts the name in the table of the database, but does not insert the pdf in the folder inside the server










share|improve this question



























    0














    the file storage is limited to 2mb. I've already tried everything, as shown in this https://kinsta.com/blog/wordpress-maximum-upload-file-size/ and I can not increase the file upload limit size.
    I leave here the code I'm using to see if it's possible to increase the size of the upload within the php code:



    $Valencia = $_POST["Valencia"];
    $dataInicio = $_POST["dataInicio"];
    $dataFim = $_POST["dataFim"];
    $pathToSave = "/var/www/html/wordpress/wp-content/themes/busiprof/Upload/";

    /*Checa se a pasta existe - caso negativo ele cria*/
    if (!file_exists($pathToSave)) {
    mkdir("$pathToSave", 0777);
    }

    if ($_FILES) { // Verificando se existe o envio de arquivos.

    if ($_FILES['txtArquivo']) { // Verifica se o campo não está vazio.
    $dir = $pathToSave; // Diretório que vai receber o arquivo.
    $tmpName = $_FILES['txtArquivo']['tmp_name']; // Recebe o arquivo temporário.

    $name = $_FILES['txtArquivo']['name']; // Recebe o nome do arquivo.
    preg_match_all('/.[a-zA-Z0-9]+/', $name, $extensao);
    if (!in_array(strtolower(current(end($extensao))), array('.txt', '.pdf', '.doc', '.xls', '.xlms'))) {
    echo('Permitido apenas arquivos doc,xls,pdf e txt.');

    die;
    }

    // move_uploaded_file( $arqTemporário, $nomeDoArquivo )
    if (move_uploaded_file($tmpName, $dir.$name)) { // move_uploaded_file irá realizar o envio do arquivo.
    echo('Arquivo adicionado com sucesso.');
    } else {
    echo('Erro ao adicionar arquivo.');
    }

    $conn->query("INSERT INTO UploadPDF (Valencia,dataInicio,dataFim,txtArquivo) VALUES ('$Valencia','$dataInicio','$dataFim','$name')");
    }
    }


    if attach a pdf of 15 mb directly in wordpress, the pdf is attached, but if it is by the above code, it inserts the name in the table of the database, but does not insert the pdf in the folder inside the server










    share|improve this question

























      0












      0








      0







      the file storage is limited to 2mb. I've already tried everything, as shown in this https://kinsta.com/blog/wordpress-maximum-upload-file-size/ and I can not increase the file upload limit size.
      I leave here the code I'm using to see if it's possible to increase the size of the upload within the php code:



      $Valencia = $_POST["Valencia"];
      $dataInicio = $_POST["dataInicio"];
      $dataFim = $_POST["dataFim"];
      $pathToSave = "/var/www/html/wordpress/wp-content/themes/busiprof/Upload/";

      /*Checa se a pasta existe - caso negativo ele cria*/
      if (!file_exists($pathToSave)) {
      mkdir("$pathToSave", 0777);
      }

      if ($_FILES) { // Verificando se existe o envio de arquivos.

      if ($_FILES['txtArquivo']) { // Verifica se o campo não está vazio.
      $dir = $pathToSave; // Diretório que vai receber o arquivo.
      $tmpName = $_FILES['txtArquivo']['tmp_name']; // Recebe o arquivo temporário.

      $name = $_FILES['txtArquivo']['name']; // Recebe o nome do arquivo.
      preg_match_all('/.[a-zA-Z0-9]+/', $name, $extensao);
      if (!in_array(strtolower(current(end($extensao))), array('.txt', '.pdf', '.doc', '.xls', '.xlms'))) {
      echo('Permitido apenas arquivos doc,xls,pdf e txt.');

      die;
      }

      // move_uploaded_file( $arqTemporário, $nomeDoArquivo )
      if (move_uploaded_file($tmpName, $dir.$name)) { // move_uploaded_file irá realizar o envio do arquivo.
      echo('Arquivo adicionado com sucesso.');
      } else {
      echo('Erro ao adicionar arquivo.');
      }

      $conn->query("INSERT INTO UploadPDF (Valencia,dataInicio,dataFim,txtArquivo) VALUES ('$Valencia','$dataInicio','$dataFim','$name')");
      }
      }


      if attach a pdf of 15 mb directly in wordpress, the pdf is attached, but if it is by the above code, it inserts the name in the table of the database, but does not insert the pdf in the folder inside the server










      share|improve this question













      the file storage is limited to 2mb. I've already tried everything, as shown in this https://kinsta.com/blog/wordpress-maximum-upload-file-size/ and I can not increase the file upload limit size.
      I leave here the code I'm using to see if it's possible to increase the size of the upload within the php code:



      $Valencia = $_POST["Valencia"];
      $dataInicio = $_POST["dataInicio"];
      $dataFim = $_POST["dataFim"];
      $pathToSave = "/var/www/html/wordpress/wp-content/themes/busiprof/Upload/";

      /*Checa se a pasta existe - caso negativo ele cria*/
      if (!file_exists($pathToSave)) {
      mkdir("$pathToSave", 0777);
      }

      if ($_FILES) { // Verificando se existe o envio de arquivos.

      if ($_FILES['txtArquivo']) { // Verifica se o campo não está vazio.
      $dir = $pathToSave; // Diretório que vai receber o arquivo.
      $tmpName = $_FILES['txtArquivo']['tmp_name']; // Recebe o arquivo temporário.

      $name = $_FILES['txtArquivo']['name']; // Recebe o nome do arquivo.
      preg_match_all('/.[a-zA-Z0-9]+/', $name, $extensao);
      if (!in_array(strtolower(current(end($extensao))), array('.txt', '.pdf', '.doc', '.xls', '.xlms'))) {
      echo('Permitido apenas arquivos doc,xls,pdf e txt.');

      die;
      }

      // move_uploaded_file( $arqTemporário, $nomeDoArquivo )
      if (move_uploaded_file($tmpName, $dir.$name)) { // move_uploaded_file irá realizar o envio do arquivo.
      echo('Arquivo adicionado com sucesso.');
      } else {
      echo('Erro ao adicionar arquivo.');
      }

      $conn->query("INSERT INTO UploadPDF (Valencia,dataInicio,dataFim,txtArquivo) VALUES ('$Valencia','$dataInicio','$dataFim','$name')");
      }
      }


      if attach a pdf of 15 mb directly in wordpress, the pdf is attached, but if it is by the above code, it inserts the name in the table of the database, but does not insert the pdf in the folder inside the server







      php wordpress pdf






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 at 17:53









      Bruno

      166




      166
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Did you tried to update your php.ini file vars?



          ; Maximum allowed size for uploaded files.
          upload_max_filesize = 20M

          ; Must be greater than or equal to upload_max_filesize
          post_max_size = 20M


          Another way you can try is adding this at the top of your code:



          ini_set('upload_max_filesize', '20M')
          ini_set('post_max_size', '20M')


          Where 20M is the max file size that you want.






          share|improve this answer





















          • In what zone do I put this part of the code in my code? ini_set('upload_max_filesize', '20M') ini_set('post_max_size', '20M')
            – Bruno
            Nov 20 at 18:15










          • try it after you declare your vars, (i think is the 5th line).
            – degreerichi
            Nov 20 at 20:53











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53398784%2fappend-pdf-greater-than-2mb%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Did you tried to update your php.ini file vars?



          ; Maximum allowed size for uploaded files.
          upload_max_filesize = 20M

          ; Must be greater than or equal to upload_max_filesize
          post_max_size = 20M


          Another way you can try is adding this at the top of your code:



          ini_set('upload_max_filesize', '20M')
          ini_set('post_max_size', '20M')


          Where 20M is the max file size that you want.






          share|improve this answer





















          • In what zone do I put this part of the code in my code? ini_set('upload_max_filesize', '20M') ini_set('post_max_size', '20M')
            – Bruno
            Nov 20 at 18:15










          • try it after you declare your vars, (i think is the 5th line).
            – degreerichi
            Nov 20 at 20:53
















          0














          Did you tried to update your php.ini file vars?



          ; Maximum allowed size for uploaded files.
          upload_max_filesize = 20M

          ; Must be greater than or equal to upload_max_filesize
          post_max_size = 20M


          Another way you can try is adding this at the top of your code:



          ini_set('upload_max_filesize', '20M')
          ini_set('post_max_size', '20M')


          Where 20M is the max file size that you want.






          share|improve this answer





















          • In what zone do I put this part of the code in my code? ini_set('upload_max_filesize', '20M') ini_set('post_max_size', '20M')
            – Bruno
            Nov 20 at 18:15










          • try it after you declare your vars, (i think is the 5th line).
            – degreerichi
            Nov 20 at 20:53














          0












          0








          0






          Did you tried to update your php.ini file vars?



          ; Maximum allowed size for uploaded files.
          upload_max_filesize = 20M

          ; Must be greater than or equal to upload_max_filesize
          post_max_size = 20M


          Another way you can try is adding this at the top of your code:



          ini_set('upload_max_filesize', '20M')
          ini_set('post_max_size', '20M')


          Where 20M is the max file size that you want.






          share|improve this answer












          Did you tried to update your php.ini file vars?



          ; Maximum allowed size for uploaded files.
          upload_max_filesize = 20M

          ; Must be greater than or equal to upload_max_filesize
          post_max_size = 20M


          Another way you can try is adding this at the top of your code:



          ini_set('upload_max_filesize', '20M')
          ini_set('post_max_size', '20M')


          Where 20M is the max file size that you want.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 at 18:05









          degreerichi

          263




          263












          • In what zone do I put this part of the code in my code? ini_set('upload_max_filesize', '20M') ini_set('post_max_size', '20M')
            – Bruno
            Nov 20 at 18:15










          • try it after you declare your vars, (i think is the 5th line).
            – degreerichi
            Nov 20 at 20:53


















          • In what zone do I put this part of the code in my code? ini_set('upload_max_filesize', '20M') ini_set('post_max_size', '20M')
            – Bruno
            Nov 20 at 18:15










          • try it after you declare your vars, (i think is the 5th line).
            – degreerichi
            Nov 20 at 20:53
















          In what zone do I put this part of the code in my code? ini_set('upload_max_filesize', '20M') ini_set('post_max_size', '20M')
          – Bruno
          Nov 20 at 18:15




          In what zone do I put this part of the code in my code? ini_set('upload_max_filesize', '20M') ini_set('post_max_size', '20M')
          – Bruno
          Nov 20 at 18:15












          try it after you declare your vars, (i think is the 5th line).
          – degreerichi
          Nov 20 at 20:53




          try it after you declare your vars, (i think is the 5th line).
          – degreerichi
          Nov 20 at 20:53


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53398784%2fappend-pdf-greater-than-2mb%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen