Exemplo n.º 1
0
 }
 switch ($errno) {
     case UPLOAD_ERR_OK:
         $ofile = $_FILES['attachfile']['tmp_name'];
         if (!file_exists($ofile)) {
             $msg = "文件传输出错!";
             break;
         }
         $oname = $_FILES['attachfile']['name'];
         if (!is_uploaded_file($ofile)) {
             die;
         }
         if (compress_bmp($ofile, $oname)) {
             $msg = "过大 BMP 图片被自动转换成 PNG 格式。";
         }
         $ret = bbs_attachment_add($board, $id, $ofile, $oname);
         if (!is_array($ret)) {
             $msg = "错误:" . bbs_error_get_desc($ret);
         } else {
             $msg .= "添加附件成功";
         }
         break;
     case UPLOAD_ERR_INI_SIZE:
     case UPLOAD_ERR_FORM_SIZE:
         $msg = "文件超过上限 " . sizestring(BBS_MAXATTACHMENTSIZE) . " 字节";
         break;
     case UPLOAD_ERR_PARTIAL:
         $msg = "文件传输出错!";
         break;
     case UPLOAD_ERR_NO_FILE:
         $msg = "没有文件上传!";
Exemplo n.º 2
0
 public function addAttach($file, $fileName)
 {
     $ret = bbs_attachment_add($this->_board->NAME, $this->ID, $file, $fileName);
     if (!is_array($ret)) {
         throw new ArchiveAttException(ECode::kbs2code($ret));
     }
     return $ret;
 }