예제 #1
0
파일: picture.php 프로젝트: 4Vs/oc-server3
         $tpl->assign('errorfile', ERROR_UPLOAD_ERR_NO_FILE);
         $bError = true;
     } else {
         if ($_FILES['file']['error'] == UPLOAD_ERR_FORM_SIZE || $_FILES['file']['error'] == UPLOAD_ERR_INI_SIZE) {
             $tpl->assign('errorfile', ERROR_UPLOAD_ERR_SIZE);
             $bError = true;
         } else {
             if ($_FILES['file']['error'] != UPLOAD_ERR_OK) {
                 $tpl->assign('errorfile', ERROR_UPLOAD_UNKNOWN);
                 $bError = true;
             } else {
                 if ($_FILES['file']['size'] > $opt['logic']['pictures']['maxsize']) {
                     $tpl->assign('errorfile', ERROR_UPLOAD_ERR_SIZE);
                     $bError = true;
                 } else {
                     if ($picture->allowedExtension($_FILES['file']['name']) == false) {
                         $tpl->assign('errorfile', ERROR_UPLOAD_ERR_TYPE);
                         $bError = true;
                     }
                 }
             }
         }
     }
 }
 if ($bError == false) {
     $picture->setLocal(1);
     list($fname, $ext) = explode('.', $_FILES['file']['name'], 2);
     // try saving file if smaller unchg_size and browser native format
     if (in_array(mb_strtolower($ext), array('gif', 'png', 'jpg', 'jpeg')) && $_FILES['file']['size'] < $opt['logic']['pictures']['unchg_size']) {
         $picture->setFilenames($_FILES['file']['name']);
         if (!move_uploaded_file($_FILES['file']['tmp_name'], $picture->getFilename())) {