Alternate to $_FILES in OXID

I was refractoring the code for my module certification and i came across to the part of documentation where it says:

Do not use global variables like:

// etc.

And this is my code which i want to refactor:

       if ($_FILES) {
            $filename = $_FILES["orderpdf"]["name"];
            $tmpfname = $_FILES["orderpdf"]["tmp_name"];
            $pdfData = $this->uploadAndReturnEncodedContent($filename, $tmpfname);

I know i can use:

$oConfig = Registry::getConfig()->getUploadedFile("orderpdf")

to get files content such as name, But what is the alternate of the IF statement block?

       if (what_is_the_alternate_of_$_FILES) {

Using OXID version CE 6.1.4

take a look at

maybe if ($oConfig->getUploadedFile("myfile"))

1 Like

I know how to use $_FILES i asked if there any alternate to it, Because in documentation its mentioned dont use global variables like: $_SESSION $_POST $_GET etc

Yeah i think this will do, Thanks! will try this.