Shouldn't this work?
if (
($_FILES["logo"]["type"] == "application/png")
|| ($_FILES["logo"]["type"] == "application/jpg")
|| ($_FILES["logo"]["type"] == "application/zip")
|| ($_FILES["logo"]["type"] == "application/jpeg")
&& ($_FILES["logo"]["type"] > 0)
){
$mail->AddAttachment($_FILES['logo']['tmp_name'], $_FILES['logo']['name']);
}
Can anyone tell me what is going on?
If the input name="logo"
is a file of type png, jpg, jpeg, or zip and there is at least one, send to mail attachment
I've checked everywhere in Stack Overflow for this, and found nothing. All I've found are basic examples on how to send a known image to myself (not very practical).
As far as I can see, there are at least 2 problems:
AND
condition will never be used as you have a lot of OR
conditions on the same level; type
where I assume you want the size
. You probably want something like:
if (
(
($_FILES["logo"]["type"] == "application/png")
|| ($_FILES["logo"]["type"] == "application/jpg")
|| ($_FILES["logo"]["type"] == "application/zip")
|| ($_FILES["logo"]["type"] == "application/jpeg")
)
&& ($_FILES["logo"]["size"] > 0)
) {
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.