public function uploadAction(Request $request)
    {
        $files = $request->files;
        $data = [];

        if ($files->count() === 1) {
            foreach ($files as $file) {
                $data = $this->doRequestUpload($file);
                break;
            }
        } else {
            if ($files->count() === 0) {
                $src = $request->request->get('src');
                $originalName = $request->request->get('originalname');
                if (null !== $src && null !== $originalName) {
                    $data = $this->doUpload($src, $originalName);
                } else {
                    throw new NotFoundHttpException('No file to upload');
                }
            } else {
                throw new BadRequestHttpException('You can upload only one file by request');
            }
        }

        return $this->createJsonResponse($data, 201);
    }