Ограничение размера загружаемого файла
Простите за глупый вопрос, но может кто нибудь подскажет, как в компоненте ограничить размер загружаемого файла?
Код:
// Get the data from the form POST
$data = JRequest::getVar('jform', array(), 'post', 'array');
print_r( $data);
if(md5($data['verify'])==$data['hvalue']){
jimport('joomla.filesystem.file');
$jFileInput = new JInput($_FILES);
$theFile = $jFileInput->get('jform',array(),'array');
$theFileName = JFile::makeSafe($theFile['name'] ['author_image']);
if ($theFileName!=""){
//Uploading the image file
if ( strtolower(JFile::getExt($theFileName) ) == 'jpg'||'png') {
// Build the paths for our file to move to the components 'upload' directory
$theFileName = JFile::makeSafe($theFile['name'] ['author_image']);
$newfilename=(rand(1,1000000))."_".$theFileName;
$tmp_src = $theFile['tmp_name']['author_image'];
$tmp_dest = "images/com_testimonial_pro/uploads/". $newfilename;
$this->dataFile = $newfilename;
// Move uploaded file
$uploaded = JFile::upload($tmp_src, $tmp_dest);
$data['author_image']=$tmp_dest;