Please help my, I'm tearing my hair out here it's been literally HOURS trying to get this to work. I have another form on another site where it works perfectly.
I have a form where someone needs to upload 1 or 2 photos - not 0. I have two separate file upload fields, "certificatesRSA" and "certificatesWhiteCard".
I can perform a check to make sure at least one image has been attached:
It's messy but it's what I got working after a lot of troubleshooting.
NOW: since I'm using a TCPDF action, if the person only uploads one image then the other one needs to be replaced with a placeholder image so that TCPDF doesn't fail.
This same sort of thing works 100% on another site - I can get and set the value of the field in question using $_POST but I CANNOT FUC*&^ING GET IT TO WORK on this site! when I try to
PLEASE HELP ME I CAN'T GO TO SLEEP TIL I GET IT WORKING AND IT'S 11PM
Here's what works perfectly fine on the other site:
I have a form where someone needs to upload 1 or 2 photos - not 0. I have two separate file upload fields, "certificatesRSA" and "certificatesWhiteCard".
I can perform a check to make sure at least one image has been attached:
$hasNoRSA = empty($this->data("certificatesRSA", ""));
$hasNoWC = empty($this->data("certificatesWhiteCard", ""));
//Return true if both RSA and WC are empty
return ($hasNoRSA && $hasNoWC);
It's messy but it's what I got working after a lot of troubleshooting.
NOW: since I'm using a TCPDF action, if the person only uploads one image then the other one needs to be replaced with a placeholder image so that TCPDF doesn't fail.
if(empty ($this->data("certificatesRSA", "")))
$_POST["certificatesRSA"] = "noCertificate.png";
if (empty($this->data("certificatesWhiteCard", "")))
{
$_POST["certificatesWhiteCard"] = "noCertificate.png";
}
This same sort of thing works 100% on another site - I can get and set the value of the field in question using $_POST but I CANNOT FUC*&^ING GET IT TO WORK on this site! when I try to
echo $_POST[field name]
even the populated field I get NOTHING, even though the debug action shows there's something there.
PLEASE HELP ME I CAN'T GO TO SLEEP TIL I GET IT WORKING AND IT'S 11PM
Here's what works perfectly fine on the other site:
if(empty($_POST['photoIDAttachment']))
$_POST['photoIDAttachment'] = "noID.png";