Beispiel #1
0
function checkForAttachments()
{
    global $formObj, $mysqli, $blnCheckForumAttachments, $prevFolder;
    $returnVal = false;
    if ($blnCheckForumAttachments) {
        $attachmentObj = new Download($mysqli);
        $downloadCatObj = new DownloadCategory($mysqli);
        $downloadCatObj->selectBySpecialKey("forumattachments");
        $forumAttachmentCatID = $downloadCatObj->get_info("downloadcategory_id");
        $arrDownloadID = array();
        $arrDLColumns = array("downloadcategory_id", "member_id", "dateuploaded", "filename", "mimetype", "filesize", "splitfile1", "splitfile2");
        for ($i = 1; $i <= $_POST['numofattachments']; $i++) {
            $tempPostName = "forumattachment_" . $i;
            if ($_FILES[$tempPostName]['name'] != "" && $attachmentObj->uploadFile($_FILES[$tempPostName], $prevFolder . "downloads/files/forumattachment/", $forumAttachmentCatID)) {
                $splitFiles = $attachmentObj->getSplitNames();
                $fileSize = $attachmentObj->getFileSize();
                $mimeType = $attachmentObj->getMIMEType();
                $arrDLValues = array($forumAttachmentCatID, $memberInfo['member_id'], time(), $_FILES[$tempPostName]['name'], $mimeType, $fileSize, "downloads/files/forumattachment/" . $splitFiles[0], "downloads/files/forumattachment/" . $splitFiles[1]);
                if ($attachmentObj->addNew($arrDLColumns, $arrDLValues)) {
                    $arrDownloadID[] = $attachmentObj->get_info("download_id");
                }
            } elseif ($_FILES[$tempPostName]['name'] != "") {
                $countErrors++;
                $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> Unable to upload attachment #" . $i . ": " . $_FILES[$tempPostName]['name'] . ".<br>";
            }
        }
        $returnVal = $arrDownloadID;
    }
    return $returnVal;
}
Beispiel #2
0
 // Check Section
 if (!in_array($_POST['section'], $arrDownloadCat)) {
     $countErrors++;
     $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid download section.<br>";
 }
 $blnUploaded = false;
 // Check Upload
 if (trim($_FILES['uploadfile']['name']) == "") {
     $countErrors++;
     $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You must select a file to upload.<br>";
 } elseif ($countErrors == 0 && $downloadObj->uploadFile($_FILES['uploadfile'], $prevFolder . "downloads/files/", $_POST['section'])) {
     $blnUploaded = true;
     $arrDLColumns = array("downloadcategory_id", "member_id", "dateuploaded", "filename", "mimetype", "filesize", "splitfile1", "splitfile2", "name", "description");
     $splitFiles = $downloadObj->getSplitNames();
     $fileSize = $downloadObj->getFileSize();
     $mimeType = $downloadObj->getMIMEType();
     $arrDLValues = array($_POST['section'], $memberInfo['member_id'], time(), $_FILES['uploadfile']['name'], $mimeType, $fileSize, "downloads/files/" . $splitFiles[0], "downloads/files/" . $splitFiles[1], $_POST['title'], $_POST['description']);
     if ($downloadObj->addNew($arrDLColumns, $arrDLValues)) {
         echo "\n\t\t\t\n\t\t\t\t<div style='display: none' id='successBox'>\n\t\t\t\t\t<p align='center'>\n\t\t\t\t\t\tSuccessfully Added Download!\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\tpopupDialog('Add Download', '" . $MAIN_ROOT . "members', 'successBox');\n\t\t\t\t</script>\n\n\t\t\t";
     } else {
         $countErrors++;
         $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> Unable to save information to the database.  Please contact the website administrator.<br>";
     }
 }
 if (!$blnUploaded) {
     $countErrors++;
     $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> Unable to upload file.  Make sure the file is not too big and has a valid extension.<br>";
 }
 if ($countErrors > 0) {
     $_POST = filterArray($_POST);
     $_POST['submit'] = false;