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
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.