Go Back   Novahq.net Forum > phphq.Net > phphq.Net Forums

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-25-2012, 09:06 PM
paulb is offline paulb
Registered User

Join Date: Aug 2012
Posts: 1

PHmailer - how to make at least one attachment mandatory

Hi,

I am using PHmailer and it works really well, however my PHP skills are a little deficient, especially in the area of arrays. Can anyone tell me or even provide the PHP code to make at least one attachment mandatory when submitting the form.

Many Thanks,
Reply With Quote
  #2  
Old 08-27-2012, 08:31 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,920

You could try using this and see if it works:

PHP Code:
If(!is_array($_FILES['attachment']) OR !array_sum($_FILES['attachment']['size'])) {  
    
$error.="You did not attach any files.<br />"

Put it between:

PHP Code:
If(trim($yourmessage)=="") { 
    
$error.="You did not enter a message!<br />";

And
PHP Code:
// Verify Attchment info
If($allowattach 0) { 
Like:

PHP Code:
If(trim($yourmessage)=="") { 
    
$error.="You did not enter a message!<br />";
}

If(!
is_array($_FILES['attachment']) OR !array_sum($_FILES['attachment']['size'])) {  
    
$error.="You did not attach any files.<br />"


// Verify Attchment info
If($allowattach 0) { 
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:03 AM.




Powered by vBulletin®