// -- check that FILE array is even set if (isset($file) && is_array($file) && !$this->upload_error($file['error'])) {
// -- cool, now set some variables $fileID=$this->_IDGenerator->getNextId('IMAGE'); $fileExt=$this->ext($file['name']); $fileName =$fileID.'.'.$fileExt; $this->createFileDir('image',$fileName); $fileTmp = $file['tmp_name']; //$fileSize = $file['size']; //$fileType = $file['type']; $fileError = $file['error'];
// -- update name $this->_name = $this->_destination.$fileName; // -- it's been uploaded with php if (is_uploaded_file($fileTmp)) { // -- where to put the file? $filePath=$this->_fileUtil->getFilePath($fileName); $output = $this->_destination.$filePath['filePath']; //resize the img first $isFileName_f=$this->resizeImage($this->_file,'f',$filePath['noExtFileName'].'_f'.$filePath['ext']); //or resize the img like this,choosed type in ('a','b','c') //$isFileName_b=$this->resizeImage($this->_file,'b',$filePath['noExtFileName'].'_b'.$filePath['ext']); if($isFileName_a==true && $isFileName_b==true && $isFileName_c==true && $isFileName_d==true){ // -- just upload it if (move_uploaded_file($fileTmp, $output)) { chmod($output, 0644); $this->result = basename($this->_name); return $this->result; } else { $this->error("Could not move '$fileName' to '$this->_destination'"); } } } else { $this->error("Possible file upload attack on '$fileName'"); } } else { $this->error("Possible file upload attack"); } }