$attach[] = array($_FILES['datafile' . $i]['tmp_name'], $file_mime_type[$i]);
     }
     $attach[] = array($_FILES['datafile9']['tmp_name'], $file_mime_type9);
     if (mimeTypeDenied($file_mime_type, $mimeTypesAllowed)) {
         if (deleteAllFiles('datafile', $qtdeIntegrantes)) {
             header("Location: http://tvcultura.cmais.com.br/preestreia/conjunto-2013?error=2");
             die;
         }
     } else {
         if (fileSizeDenied($file_size, $maxFileSize)) {
             if (deleteAllFiles('datafile', $qtdeIntegrantes)) {
                 header("Location: http://tvcultura.cmais.com.br/preestreia/conjunto-2013?error=3");
                 die;
             }
         } else {
             if (sendMailAtt($to, $from, $subject, $message, $attach)) {
                 if (deleteAllFiles('datafile', $qtdeIntegrantes)) {
                     header("Location: http://tvcultura.cmais.com.br/preestreia/conjunto-2013?success=1");
                     die;
                 }
             } else {
                 if (deleteAllFiles('datafile', $qtdeIntegrantes)) {
                     header("Location: http://tvcultura.cmais.com.br/preestreia/conjunto-2013?error=1");
                     die;
                 }
             }
         }
     }
 } else {
     if (deleteAllFiles('datafile', $qtdeIntegrantes)) {
         header("Location: http://tvcultura.cmais.com.br/preestreia/conjunto-2013?error=4");
                if (unlink($_FILES['datafile']['tmp_name'])) {
                    header("Location:http://tvcultura.cmais.com.br/cartaozinho/mande-sua-foto?error=3");
                    //die("2");
                }
            } else {
                if (sendMailAtt($to, $from, $subject, $message, $attach)) {
                    if (unlink($_FILES['datafile']['tmp_name'])) {
                        //die("Location: http://172.20.16.219/cartaozinho/mande-sua-foto?success=1#esquerda");
                        header("Location:http://tvcultura.cmais.com.br/cartaozinho/mande-sua-foto?success=2");
                    }
                } else {
                    if (unlink($_FILES['datafile']['tmp_name'])) {
                        header("Location:http://tvcultura.cmais.com.br/cartaozinho/mande-sua-foto?error=1");
                        //die("3");
                    }
                }
            }
        }
    } else {
        if (sendMailAtt($to, $from, $subject, $message)) {
            die("Location:http://tvcultura.cmais.com.br/cartaozinho/mande-sua-foto?success=2#esquerda");
            header("Location:http://tvcultura.cmais.com.br/cartaozinho/mande-sua-foto?success=2#esquerda");
        } else {
            header("Location:http://tvcultura.cmais.com.br/cartaozinho/mande-sua-foto?error=1#esquerda");
            die("3");
        }
    }
    //}
}
?>