Upload::setUploadInfo
Set the upload options at once
Description
public boolean Upload::setUploadInfo( array $data )
Calls Upload::setUploadDir, Upload::setMaxFileSize and Upload::setFileType for the keys present in $data. Returns false when one of them fails.
Arguments
| Name | Data type | Default | Remarks |
|---|---|---|---|
| $data | array | Options (see below) |
| Key | Data type | Remarks |
|---|---|---|
| upDir | string | Upload directory |
| maxFileSize | numeric | Maximum file size (MB) |
| fileType | array | Allowed extensions |
Example
Controller
use Fegg\Tool\Upload;
$upload = new Upload();
$upload->setUploadInfo(array(
'upDir' => $this->config['upload_dir']['path'] . '/entry',
'maxFileSize' => 5,
'fileType' => array('jpg', 'png', 'pdf'),
));