public function handleUpload(SS_HTTPRequest $request)
    {
        $request->setUrl('upload');

        /** @var Folder $folder */
        $folder = Folder::get()->byID($request->param('FolderID'));

        /** @var FileAttachmentField $uploader */
        $uploader = FileAttachmentField::create('dummy');

        if ($folder) {
            $uploader->setFolderName(self::remove_assets_dir($folder->Filename));
        } else {
            $uploader->setFolderName('/');
        }

        /** @var SS_HTTPResponse $httpResponse */
        $httpResponse = $uploader->handleRequest($request, DataModel::inst());

        if ($httpResponse->getStatusCode() !== 200) {
            return $httpResponse;
        }

        $ids = $httpResponse->getBody();
        $files = File::get()->byIDs(explode(',', $ids));
        $result = array();

        foreach ($files as $f) {
            $result[] = $this->createFileJson($f, $folder);
        }

        $response = new SS_HTTPResponse(
            Convert::array2json($result), 200
        );

        return $response->addHeader('Content-Type', 'application/json');
    }