public function dataUpload($fileData)
    {
        $filename = null;
        if (is_array($fileData)) {
            // retrieve tmp file from temp dir
            $tmpDir = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
            $tmpFile = $tmpDir.$fileData['id'];

            if (!file_exists($tmpFile)) {
                throw new Exception(
                    'File does not exists.'
                );
            }
            $fileContent = file_get_contents($tmpFile);
            $filename = (!empty($fileData['name'])) ? $fileData['name'] : null;
            // delete tmp file
            unlink($tmpFile);
        } else {
            $fileContent = file_get_contents($fileData);
        }

        if ($fileContent === false) {
            throw new Exception(
                'File content could not be decoded.'
            );
        }

        $info = new finfo(FILEINFO_MIME_TYPE);
        $this->setMimetype($info->buffer($fileContent));
        $this->setFilesize(strlen($fileContent));
        if (!$this->validateAcceptedMimetypes() || !$this->validateMaxFilesize()) {
            return '';
        }

        $target = $this->uploadTarget($filename);

        $ret = file_put_contents($target, $fileContent);
        if ($ret === false) {
            return '';
        } else {
            $basePath = $this->basePath();
            $target = str_replace($basePath, '', $target);

            return $target;
        }
    }