get file name without extension in laravel?

前端 未结 13 920
温柔的废话
温柔的废话 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 01:57

    This one is pretty clean:

      $fileName = pathinfo($fullFileName)['filename'];
    

    Equivalent to:

      $fileName = pathinfo($fullFileName, PATHINFO_FILENAME);
    

    https://php.net/manual/en/function.pathinfo.php

提交回复
热议问题