Добавить новость
smi24.net
Интернет
Апрель
2019

Ограничение размера загружаемого файла

0
Простите за глупый вопрос, но может кто нибудь подскажет, как в компоненте ограничить размер загружаемого файла?

Код:

// 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;















Музыкальные новости






















СМИ24.net — правдивые новости, непрерывно 24/7 на русском языке с ежеминутным обновлением *