protected function outputUploadOutcome()
    {
        $json = new \stdClass();
        // errors
        if(!$this->uploadOk) {
            if($this->uploader->getMessages()) {
                $this->uploadMessages[] = implode('\n', $this->uploader->getMessages());
            }
            $json->error = implode('\n', $this->uploadMessages);
            $this->httpResponse = $this->httpResponse->withStatus('412', $json->error);
        } else {
            //input file informations
            $json->input = [
                'name' => $this->uploadFields[$this->uploadedField]->getInputFile(),
                'hash' => $this->uploadFields[$this->uploadedField]->getInputHash()
            ];
            // generated file(s) paths
            $json->outputs = $this->uploadFields[$this->uploadedField]->getOutputsFiles();
        }
        return json_encode($json);
    }
protected function outputUploadOutcome()
    {
        $json = new \stdClass();
        // errors
        if(!$this->uploadOk) {
            if($this->uploader->getMessages()) {
                $this->uploadMessages[] = implode('\n', $this->uploader->getMessages());
            }
            $json->error = implode('\n', $this->uploadMessages);
            $this->httpResponse = $this->httpResponse->withStatus('412', $json->error);
        } else {
            //input file informations
            $json->input = [
                'name' => $this->uploadFields[$this->uploadedField]->getInputFile(),
                'hash' => $this->uploadFields[$this->uploadedField]->getInputHash()
            ];
            // generated file(s) paths
            $json->outputs = $this->uploadFields[$this->uploadedField]->getOutputsFiles();
        }
        return json_encode($json);
    }
protected function outputUploadOutcome ( ) { $ json = new \ stdClass ( ) ; // errors if ( ! $ this -> uploadOk ) { if ( $ this -> uploader -> getMessages ( ) ) { $ this -> uploadMessages [ ] = implode ( '\n' , $ this -> uploader -> getMessages ( ) ) ; } $ json -> error = implode ( '\n' , $ this -> uploadMessages ) ; $ this -> httpResponse = $ this -> httpResponse -> withStatus ( '412' , $ json -> error ) ; } else { //input file informations $ json -> input = [ 'name' => $ this -> uploadFields [ $ this -> uploadedField ] -> getInputFile ( ) , 'hash' => $ this -> uploadFields [ $ this -> uploadedField ] -> getInputHash ( ) ] ; // generated file(s) paths $ json -> outputs = $ this -> uploadFields [ $ this -> uploadedField ] -> getOutputsFiles ( ) ; } return json_encode ( $ json ) ; }
Outputs to browser upload outcome in json format for ajax calls benefit
@return string json code
Outputs to browser upload outcome in json format for ajax calls benefit