protected function process_response_files($name, $draftidname, $postdata = null, $text = null) {
        if ($postdata) {
            // For simulated posts, get the draft itemid from there.
            $draftitemid = $this->get_submitted_var($draftidname, PARAM_INT, $postdata);
        } else {
            $draftitemid = file_get_submitted_draft_itemid($draftidname);
        }

        if (!$draftitemid) {
            return null;
        }

        $filearea = str_replace($this->get_field_prefix(), '', $name);
        $filearea = str_replace('-', 'bf_', $filearea);
        $filearea = 'response_' . $filearea;
        return new question_file_saver($draftitemid, 'question', $filearea, $text);
    }
protected function process_response_files($name, $draftidname, $postdata = null, $text = null) {
        if ($postdata) {
            // For simulated posts, get the draft itemid from there.
            $draftitemid = $this->get_submitted_var($draftidname, PARAM_INT, $postdata);
        } else {
            $draftitemid = file_get_submitted_draft_itemid($draftidname);
        }

        if (!$draftitemid) {
            return null;
        }

        $filearea = str_replace($this->get_field_prefix(), '', $name);
        $filearea = str_replace('-', 'bf_', $filearea);
        $filearea = 'response_' . $filearea;
        return new question_file_saver($draftitemid, 'question', $filearea, $text);
    }
protected function process_response_files ( $ name , $ draftidname , $ postdata = null , $ text = null ) { if ( $ postdata ) { // For simulated posts, get the draft itemid from there. $ draftitemid = $ this -> get_submitted_var ( $ draftidname , PARAM_INT , $ postdata ) ; } else { $ draftitemid = file_get_submitted_draft_itemid ( $ draftidname ) ; } if ( ! $ draftitemid ) { return null ; } $ filearea = str_replace ( $ this -> get_field_prefix ( ) , '' , $ name ) ; $ filearea = str_replace ( '-' , 'bf_' , $ filearea ) ; $ filearea = 'response_' . $ filearea ; return new question_file_saver ( $ draftitemid , 'question' , $ filearea , $ text ) ; }
Handle a submitted variable representing uploaded files.
@param string $name the field name.
@param string $draftidname the field name holding the draft file area id.
@param array $postdata (optional, only inteded for testing use) take the
data from this array, instead of from $_POST. At the moment, this
behaves as if there were no files.
@param string $text optional reponse text.
@return question_file_saver that can be used to save the files later.
Handle a submitted variable representing uploaded files .