get file name without extension in laravel?

前端 未结 13 1132
温柔的废话
温柔的废话 2021-02-05 01:14

I have used Input::file(\'upfile\')->getClientOriginalName() to retrieve name of uploaded file but gives name with extension like qwe.jpg.How do I g

13条回答
  •  甜味超标
    2021-02-05 02:08

    Laravel uses Symfony UploadedFile component that will be returned by Input::file() method.

    It hasn't got any method to retrive file name, so you can use php native function pathinfo():

    pathinfo(Input::file('upfile')->getClientOriginalName(), PATHINFO_FILENAME);
    

提交回复
热议问题