protected function getUploadedPackage()
    {
        if (!$this->hasRequestParameter(self::RESTITEM_PACKAGE_NAME)) {
            throw new \common_exception_MissingParameter(self::RESTITEM_PACKAGE_NAME, __CLASS__);
        }

        $file = \tao_helpers_Http::getUploadedFile(self::RESTITEM_PACKAGE_NAME);

        if (!in_array($file['type'], self::$accepted_types)) {
            throw new \common_exception_BadRequest('Uploaded file has to be a valid archive.');
        }

        $pathinfo = pathinfo($file['tmp_name']);
        $destination = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $file['name'];
        \tao_helpers_File::move($file['tmp_name'], $destination);

        return $destination;
    }
protected function getUploadedPackage()
    {
        if (!$this->hasRequestParameter(self::RESTITEM_PACKAGE_NAME)) {
            throw new \common_exception_MissingParameter(self::RESTITEM_PACKAGE_NAME, __CLASS__);
        }

        $file = \tao_helpers_Http::getUploadedFile(self::RESTITEM_PACKAGE_NAME);

        if (!in_array($file['type'], self::$accepted_types)) {
            throw new \common_exception_BadRequest('Uploaded file has to be a valid archive.');
        }

        $pathinfo = pathinfo($file['tmp_name']);
        $destination = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $file['name'];
        \tao_helpers_File::move($file['tmp_name'], $destination);

        return $destination;
    }
protected function getUploadedPackage ( ) { if ( ! $ this -> hasRequestParameter ( self :: RESTITEM_PACKAGE_NAME ) ) { throw new \ common_exception_MissingParameter ( self :: RESTITEM_PACKAGE_NAME , __CLASS__ ) ; } $ file = \ tao_helpers_Http :: getUploadedFile ( self :: RESTITEM_PACKAGE_NAME ) ; if ( ! in_array ( $ file [ 'type' ] , self :: $ accepted_types ) ) { throw new \ common_exception_BadRequest ( 'Uploaded file has to be a valid archive.' ) ; } $ pathinfo = pathinfo ( $ file [ 'tmp_name' ] ) ; $ destination = $ pathinfo [ 'dirname' ] . DIRECTORY_SEPARATOR . $ file [ 'name' ] ; \ tao_helpers_File :: move ( $ file [ 'tmp_name' ] , $ destination ) ; return $ destination ; }
Return a valid uploaded file

@return string
@throws \common_Exception
@throws \common_exception_Error
@throws \common_exception_MissingParameter
@throws \common_exception_BadRequest
@throws \oat\tao\helpers\FileUploadException
Return a valid uploaded file