Skip to main content
Version: Fegg 5.x (next)

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​

NameData typeDefaultRemarks
$dataarrayOptions (see below)
KeyData typeRemarks
upDirstringUpload directory
maxFileSizenumericMaximum file size (MB)
fileTypearrayAllowed 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'),
));