public function upload()
    {
        try {
            if ($this->getRequestMethod() !== \Request::HTTP_POST) {
                throw new \common_exception_NotImplemented('Only post method is accepted.');
            }
            if (!isset($_POST['upload']) || !is_string($_POST['upload'])) {
                throw new \common_exception_InconsistentData("'upload' POST variable is missed.");
            }
            $size = mb_strlen($_POST['upload'], '8bit');
            $result = ['success' => true, 'size' => $size];
        } catch (\common_exception_NotImplemented $e) {
            $result = ['success' => false, 'error' => $e->getMessage()];
            $this->logWarning($e->getMessage());
        } catch (\common_exception_InconsistentData $e) {
            $result = ['success' => false, 'error' => $e->getMessage()];
            $this->logWarning($e->getMessage());
        } catch (\Exception $e) {
            $result = ['success' => false, 'type' => 'error', 'message' => 'Please contact administrator'];
            $this->logWarning($e->getMessage());
        }
        $this->returnJson($result);
    }
public function upload()
    {
        try {
            if ($this->getRequestMethod() !== \Request::HTTP_POST) {
                throw new \common_exception_NotImplemented('Only post method is accepted.');
            }
            if (!isset($_POST['upload']) || !is_string($_POST['upload'])) {
                throw new \common_exception_InconsistentData("'upload' POST variable is missed.");
            }
            $size = mb_strlen($_POST['upload'], '8bit');
            $result = ['success' => true, 'size' => $size];
        } catch (\common_exception_NotImplemented $e) {
            $result = ['success' => false, 'error' => $e->getMessage()];
            $this->logWarning($e->getMessage());
        } catch (\common_exception_InconsistentData $e) {
            $result = ['success' => false, 'error' => $e->getMessage()];
            $this->logWarning($e->getMessage());
        } catch (\Exception $e) {
            $result = ['success' => false, 'type' => 'error', 'message' => 'Please contact administrator'];
            $this->logWarning($e->getMessage());
        }
        $this->returnJson($result);
    }
public function upload ( ) { try { if ( $ this -> getRequestMethod ( ) !== \ Request :: HTTP_POST ) { throw new \ common_exception_NotImplemented ( 'Only post method is accepted.' ) ; } if ( ! isset ( $ _POST [ 'upload' ] ) || ! is_string ( $ _POST [ 'upload' ] ) ) { throw new \ common_exception_InconsistentData ( "'upload' POST variable is missed." ) ; } $ size = mb_strlen ( $ _POST [ 'upload' ] , '8bit' ) ; $ result = [ 'success' => true , 'size' => $ size ] ; } catch ( \ common_exception_NotImplemented $ e ) { $ result = [ 'success' => false , 'error' => $ e -> getMessage ( ) ] ; $ this -> logWarning ( $ e -> getMessage ( ) ) ; } catch ( \ common_exception_InconsistentData $ e ) { $ result = [ 'success' => false , 'error' => $ e -> getMessage ( ) ] ; $ this -> logWarning ( $ e -> getMessage ( ) ) ; } catch ( \ Exception $ e ) { $ result = [ 'success' => false , 'type' => 'error' , 'message' => 'Please contact administrator' ] ; $ this -> logWarning ( $ e -> getMessage ( ) ) ; } $ this -> returnJson ( $ result ) ; }
Action is used to check upload speed from client side.
Action is used to check upload speed from client side .