I try to switch to media uploader but then when I try to upload the zero byte file I see the following error which you already know of:
File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini file or by post_max_size being defined as smaller than upload_max_filesize in php.ini.
It seems WordPress does not allow to upload the zero byte file itself.
yes, exactly with the wordpress media uploader this error is handled in that way however I use the form to let non-logged in visitor users enter data and media and for this reason I cannot use it (media uploader)
unfortunately it generates this error with email notifications activated, I don't understand the difference how the problem is handled when they are not activated and when they are
The filter doesn't work it keeps giving me the fatal error, momentarily I set this jquery code to block the form if a file with weight equal to 0 is loaded
var fileInputs = $("input[type=file]");
var isValidLWF = true;
$('.allegati-error').hide();
fileInputs.each(function() {
var fileInput = this;
if (fileInput.files.length > 0) {
var fileSize = fileInput.files[0].size;
if (fileSize === 0) {
isValidLWF = false;
$('.allegati-error').show();
return false;
}
}
});
Can you please share problem URL where I can see the issue again and share admin access and tell me where exactly you added the code snippet I shared.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I've no update as I already shared workaround that should work. Regarding PHP 8 fatal error it may take long time as WordPress itself seems not allowing the zero byte file upload. For now you have to use workaround we shared.
I have a question! I attached screenshot where the check is made when a file is loaded, in this case the file exceeds the allowed weight limit, can it also be done for the file that does not exceed a minimum weight?