kernel/lib/Upload.php
public function upload(string $sFile)
	{
		if ($_FILES[$sFile]['error'] > 0) {

			$this->_sError = "Error while the upload";
			return false;
		}

		if ($_FILES[$sFile]['size'] > $this->_iMaxFile) {

			$this->_sError = "The file is too big";
			return false;
		}

		$sExtension = strtolower(substr(strrchr($_FILES[$sFile]['name'], '.'), 1));

		if (count($this->_aAllowExtension) > 0 && !in_array($sExtension ,$this->_aAllowExtension)) {

			$this->_sError = "The extension is not good";
			return false;
		}

		$sPath = str_replace('bundles'.DIRECTORY_SEPARATOR.'lib',
			'data'.DIRECTORY_SEPARATOR.'upload'.DIRECTORY_SEPARATOR, __DIR__);

		if ($this->_sExtension === null) { $this->setExtension($sExtension); }

		if ($this->_sName) { $sName = $sPath.$this->_sName.'.'.$this->_sExtension; }
		else { $sName = $sPath.md5(uniqid(rand(), true)).'.'.$this->_sExtension;}

		if ($this->_bProportion === true && ($this->_iWidth || $this->_iHeight)) {

			$aImageSizes = getimagesize($_FILES[$sFile]['tmp_name']);

			$fRatio = min($aImageSizes[0] / $this->_iWidth, $aImageSizes[1] / $this->_iHeight);
    		$iHeight =  $aImageSizes[1] / $fRatio;
    		$iWidth =  $aImageSizes[0] / $fRatio;
    		$fY = ($iHeight - $this->_iHeight) / 2 * $fRatio;
    		$fX = ($iWidth - $this->_iWidth) / 2 * $fRatio;

			$rNewImage = imagecreatefromjpeg($_FILES[$sFile]['tmp_name']);

			$rNewImgTrueColor = imagecreatetruecolor($this->_iWidth , $this->_iHeight);
			imagecopyresampled($rNewImgTrueColor , $rNewImage, 0, 0, $fX, $fY, $this->_iWidth, $this->_iHeight, $iWidth * $fRatio - $fX * 2, $iHeight * $fRatio - $fY * 2);

			imagejpeg($rNewImgTrueColor , $sName, 100);
		}
		else {

			$bResultat = move_uploaded_file($_FILES[$sFile]['tmp_name'], $sName);

			if ($bResultat) { return true; }
		}


	}
public function upload(string $sFile)
	{
		if ($_FILES[$sFile]['error'] > 0) {

			$this->_sError = "Error while the upload";
			return false;
		}

		if ($_FILES[$sFile]['size'] > $this->_iMaxFile) {

			$this->_sError = "The file is too big";
			return false;
		}

		$sExtension = strtolower(substr(strrchr($_FILES[$sFile]['name'], '.'), 1));

		if (count($this->_aAllowExtension) > 0 && !in_array($sExtension ,$this->_aAllowExtension)) {

			$this->_sError = "The extension is not good";
			return false;
		}

		$sPath = str_replace('bundles'.DIRECTORY_SEPARATOR.'lib',
			'data'.DIRECTORY_SEPARATOR.'upload'.DIRECTORY_SEPARATOR, __DIR__);

		if ($this->_sExtension === null) { $this->setExtension($sExtension); }

		if ($this->_sName) { $sName = $sPath.$this->_sName.'.'.$this->_sExtension; }
		else { $sName = $sPath.md5(uniqid(rand(), true)).'.'.$this->_sExtension;}

		if ($this->_bProportion === true && ($this->_iWidth || $this->_iHeight)) {

			$aImageSizes = getimagesize($_FILES[$sFile]['tmp_name']);

			$fRatio = min($aImageSizes[0] / $this->_iWidth, $aImageSizes[1] / $this->_iHeight);
    		$iHeight =  $aImageSizes[1] / $fRatio;
    		$iWidth =  $aImageSizes[0] / $fRatio;
    		$fY = ($iHeight - $this->_iHeight) / 2 * $fRatio;
    		$fX = ($iWidth - $this->_iWidth) / 2 * $fRatio;

			$rNewImage = imagecreatefromjpeg($_FILES[$sFile]['tmp_name']);

			$rNewImgTrueColor = imagecreatetruecolor($this->_iWidth , $this->_iHeight);
			imagecopyresampled($rNewImgTrueColor , $rNewImage, 0, 0, $fX, $fY, $this->_iWidth, $this->_iHeight, $iWidth * $fRatio - $fX * 2, $iHeight * $fRatio - $fY * 2);

			imagejpeg($rNewImgTrueColor , $sName, 100);
		}
		else {

			$bResultat = move_uploaded_file($_FILES[$sFile]['tmp_name'], $sName);

			if ($bResultat) { return true; }
		}


	}
public function upload ( string $ sFile ) { if ( $ _FILES [ $ sFile ] [ 'error' ] > 0 ) { $ this -> _sError = "Error while the upload" ; return false ; } if ( $ _FILES [ $ sFile ] [ 'size' ] > $ this -> _iMaxFile ) { $ this -> _sError = "The file is too big" ; return false ; } $ sExtension = strtolower ( substr ( strrchr ( $ _FILES [ $ sFile ] [ 'name' ] , '.' ) , 1 ) ) ; if ( count ( $ this -> _aAllowExtension ) > 0 && ! in_array ( $ sExtension , $ this -> _aAllowExtension ) ) { $ this -> _sError = "The extension is not good" ; return false ; } $ sPath = str_replace ( 'bundles' . DIRECTORY_SEPARATOR . 'lib' , 'data' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR , __DIR__ ) ; if ( $ this -> _sExtension === null ) { $ this -> setExtension ( $ sExtension ) ; } if ( $ this -> _sName ) { $ sName = $ sPath . $ this -> _sName . '.' . $ this -> _sExtension ; } else { $ sName = $ sPath . md5 ( uniqid ( rand ( ) , true ) ) . '.' . $ this -> _sExtension ; } if ( $ this -> _bProportion === true && ( $ this -> _iWidth || $ this -> _iHeight ) ) { $ aImageSizes = getimagesize ( $ _FILES [ $ sFile ] [ 'tmp_name' ] ) ; $ fRatio = min ( $ aImageSizes [ 0 ] / $ this -> _iWidth , $ aImageSizes [ 1 ] / $ this -> _iHeight ) ; $ iHeight = $ aImageSizes [ 1 ] / $ fRatio ; $ iWidth = $ aImageSizes [ 0 ] / $ fRatio ; $ fY = ( $ iHeight - $ this -> _iHeight ) / 2 * $ fRatio ; $ fX = ( $ iWidth - $ this -> _iWidth ) / 2 * $ fRatio ; $ rNewImage = imagecreatefromjpeg ( $ _FILES [ $ sFile ] [ 'tmp_name' ] ) ; $ rNewImgTrueColor = imagecreatetruecolor ( $ this -> _iWidth , $ this -> _iHeight ) ; imagecopyresampled ( $ rNewImgTrueColor , $ rNewImage , 0 , 0 , $ fX , $ fY , $ this -> _iWidth , $ this -> _iHeight , $ iWidth * $ fRatio - $ fX * 2 , $ iHeight * $ fRatio - $ fY * 2 ) ; imagejpeg ( $ rNewImgTrueColor , $ sName , 100 ) ; } else { $ bResultat = move_uploaded_file ( $ _FILES [ $ sFile ] [ 'tmp_name' ] , $ sName ) ; if ( $ bResultat ) { return true ; } } }
get an upload file

@access public
@param  string $sFile
@return bool|object
get an upload file