modules/media/Media.php
public function mediaUpload($fileName = 'file', $useFile = false)
    {
        $file = UploadedFile::getInstanceByName($fileName);

        if ($useFile !== false) {
            $file = $file[0];
        }

        if (is_null($file)) {
            throw new BadRequestHttpException('No file specified to upload.');
        }

        return $this->insertMedia($file);
    }
public function mediaUpload($fileName = 'file', $useFile = false)
    {
        $file = UploadedFile::getInstanceByName($fileName);

        if ($useFile !== false) {
            $file = $file[0];
        }

        if (is_null($file)) {
            throw new BadRequestHttpException('No file specified to upload.');
        }

        return $this->insertMedia($file);
    }
Uploads the file
if success returns json array for media data

@param string $fileName
@param bool $useFile
@return bool|string
@throws \yii\web\BadRequestHttpException