public function deleteFile(Request $request)
    {
        $namespace = $request->request->get('namespace');
        $filename = $request->request->get('filename');

        try {
            $this->filesystem()->delete("$namespace://$filename");

            return $this->json($filename, Response::HTTP_OK);
        } catch (ExceptionInterface $e) {
            $msg = Trans::__('Unable to delete file: %FILE%', ['%FILE%' => $filename]);
            $this->logException($msg, $e);

            return $this->json(
                $msg,
                $e instanceof FileNotFoundException ? Response::HTTP_NOT_FOUND : Response::HTTP_INTERNAL_SERVER_ERROR
            );
        }
    }
public function deleteFile(Request $request)
    {
        $namespace = $request->request->get('namespace');
        $filename = $request->request->get('filename');

        try {
            $this->filesystem()->delete("$namespace://$filename");

            return $this->json($filename, Response::HTTP_OK);
        } catch (ExceptionInterface $e) {
            $msg = Trans::__('Unable to delete file: %FILE%', ['%FILE%' => $filename]);
            $this->logException($msg, $e);

            return $this->json(
                $msg,
                $e instanceof FileNotFoundException ? Response::HTTP_NOT_FOUND : Response::HTTP_INTERNAL_SERVER_ERROR
            );
        }
    }
public function deleteFile ( Request $ request ) { $ namespace = $ request -> request -> get ( 'namespace' ) ; $ filename = $ request -> request -> get ( 'filename' ) ; try { $ this -> filesystem ( ) -> delete ( "$namespace://$filename" ) ; return $ this -> json ( $ filename , Response :: HTTP_OK ) ; } catch ( ExceptionInterface $ e ) { $ msg = Trans :: __ ( 'Unable to delete file: %FILE%' , [ '%FILE%' => $ filename ] ) ; $ this -> logException ( $ msg , $ e ) ; return $ this -> json ( $ msg , $ e instanceof FileNotFoundException ? Response :: HTTP_NOT_FOUND : Response :: HTTP_INTERNAL_SERVER_ERROR ) ; } }
Delete a file on the server.

@param Request $request

@return \Symfony\Component\HttpFoundation\JsonResponse
Delete a file on the server .