Skip to content

hxmwr/upload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

upload

A simple upload class of php.

usage

Depends on a OO file object, like Phalcon\Http\Request\File and FileInfo, or you can implement your own file class.

$config = [
      'scene1' => [
           'baseDir' => 'path/to/save/images/',
           'urlPrefix' => '/website/upload/images/',
           'rules' => [
               'size' => [1000000, '文件大小不超过1M'],
               'type' => [['image/jpeg', 'image/png'], 'Only jpg and png allowed'],
               'exts' => [['jpg', 'png'], 'Only jpg and png allowed'],
               'dims' => [[600,800], 'Required image width is 600 and height is 800']
           ]
      ]
];
  
$uploader = new Uploader($config);
if (!$uploader->upload($file)) {
  echo $uploader->getError();
}

About

Simple upload class of php

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages