Overview

Namespaces

  • Kotchasan
    • Cache
    • Database
    • Http
    • Log
    • Orm
  • None
  • PHP
  • Psr
    • Cache
    • Http
      • Message
    • Log

Classes

  • Accordion
  • ApiController
  • ArrayTool
  • CKEditor
  • Collection
  • Config
  • Controller
  • Country
  • Csv
  • Curl
  • Currency
  • Database
  • DataTable
  • Date
  • DOMNode
  • DOMParser
  • Email
  • File
  • Files
  • Form
  • Grid
  • Html
  • Htmldoc
  • HtmlTable
  • Image
  • InputItem
  • Inputs
  • KBase
  • Language
  • ListItem
  • Login
  • Menu
  • Mime
  • Model
  • Number
  • ObjectTool
  • Password
  • Pdf
  • Province
  • Router
  • Session
  • Singleton
  • Tab
  • TableRow
  • Template
  • Text
  • Validator
  • View

Exceptions

  • ApiException
  • InputItemException
  • Overview
  • Namespace
  • Class
  • Tree

Class Mime

MIME type for a file extension.

Namespace: Kotchasan
Author: Goragod Wiriya admin@goragod.com
Since: 1.0
Located at Kotchasan/Mime.php
Methods summary
public static
# typies( )
public static string|array|null
# get( string|array $exts )

Get the MIME type for a file extension คืนค่า null ถ้าไม่พบ.

Get the MIME type for a file extension คืนค่า null ถ้าไม่พบ.

Parameters

$exts

Returns

string|array|null

Assert

(array('jpg','gif','png')) [==] array('jpg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png')
('jpg') [==] 'image/jpeg'
public static boolean
# check( array $typies, string $mime )

ฟังก์ชั่น ตรวจสอบ $typies ว่าตรงกับ $mime หรือไม่ ใช้สำหรับการตรวจสอบไฟล์อัปโหลด คืนค่า true หาก $mime และ $typies สอดคล้องกัน.

ฟังก์ชั่น ตรวจสอบ $typies ว่าตรงกับ $mime หรือไม่ ใช้สำหรับการตรวจสอบไฟล์อัปโหลด คืนค่า true หาก $mime และ $typies สอดคล้องกัน.

Parameters

$typies
ชนิดของไฟล์ที่ยอมรับ เช่น array(jpg, gif, png)
$mime
ชนิดของไฟล์ที่ต้องการตรวจสอบ เช่น image/png ซึ่งปกติจะได้จากการอัปโหลด เช่น $file[mime]

Returns

boolean

Assert

(array('jpg','gif','png'), 'image/png') [==] true
public static string
# getAccept( array $typies )

ฟังก์ชั่น อ่าน mimetype ของไฟล์ สำหรับส่งให้ input ชนิด file คืนค่า mimetype ของไฟล์ คั่นแต่ละรายการด้วย , เช่น image/jpeg,image/png,image/gif.

ฟังก์ชั่น อ่าน mimetype ของไฟล์ สำหรับส่งให้ input ชนิด file คืนค่า mimetype ของไฟล์ คั่นแต่ละรายการด้วย , เช่น image/jpeg,image/png,image/gif.

Parameters

$typies
ชนิดของไฟล์ เช่น array(jpg, gif, png)

Returns

string

Assert

(array('jpg','gif','png')) [==] "image/jpeg,image/gif,image/png"
Kotchasan API documentation generated by ApiGen