示例#1
0
 db('File Attachments:');
 ###  attachments wanted for current form? (tracking session form uploads handled above!)
 $doAttach = !$cformsSettings['form' . $no]['cforms' . $no . '_noattachments'];
 ### form w/ files, within session or single form
 if ($doAttach && $ongoingSession != '0' && is_array($file)) {
     foreach ($file[tmp_name] as $fn) {
         cf_base64($fn, $doAttach);
         ### debug
         db("File = {$fn}, attach = {$doAttach}");
     }
 }
 ### end of session w/ files
 if ($ongoingSession == '0' && is_array($_SESSION['cforms']['upload'])) {
     foreach (array_keys($_SESSION['cforms']['upload']) as $n) {
         foreach (array_keys($_SESSION['cforms']['upload'][$n]['files']) as $m) {
             cf_base64(str_replace('xx', $subID, $_SESSION['cforms']['upload'][$n]['files'][$m]), $_SESSION['cforms']['upload'][$n]['doAttach']);
             ### debug
             db("(end of session) File = " . $_SESSION['cforms']['upload'][$n]['files'][$m] . ", attach = " . $_SESSION['cforms']['upload'][$n]['doAttach']);
         }
     }
 }
 ### parse through all files (both single and mp forms)
 foreach ($fdata as $file) {
     if ($file[doAttach] && $file[name] != '') {
         $n = substr($file[name], strrpos($file[name], $cformsSettings['global']['cforms_IIS']) + 1, strlen($file[name]));
         $m = getMIME(strtolower(substr($n, strrpos($n, '.') + 1, strlen($n))));
         $mail->add_file($file[name], $n, 'base64', $m);
         ### optional name
         ### debug
         db('Attaching file (' . $file[name] . ') to email');
     }
示例#2
0
 global $fdata, $fpointer;
 $fdata = array();
 $fpointer = 0;
 ###  attachments wanted?
 if (!$cformsSettings['form' . $no]['cforms' . $no . '_noattachments']) {
     ### no session, single form w/ files
     if ($inSession != '0' && is_array($file)) {
         foreach ($file[tmp_name] as $fn) {
             cf_base64($fn);
         }
     }
     ### session w/ files
     if ($inSession == '0' && is_array($_SESSION['cforms']['upload'])) {
         foreach (array_keys($_SESSION['cforms']['upload']) as $n) {
             foreach (array_keys($_SESSION['cforms']['upload'][$n]) as $m) {
                 cf_base64(str_replace('xx', $subID, $_SESSION['cforms']['upload'][$n][$m]));
             }
         }
     }
     ### parse through all files
     foreach ($fdata as $file) {
         if ($file[name] != '') {
             $n = substr($file[name], strrpos($file[name], $cformsSettings['global']['cforms_IIS']) + 1, strlen($file[name]));
             $m = getMIME(strtolower(substr($n, strrpos($n, '.') + 1, strlen($n))));
             $mail->add_file($file[name], $n, 'base64', $m);
             ### optional name
         }
     }
 }
 ### end adding attachments
 ###