get file name without extension in laravel?

前端 未结 13 882
温柔的废话
温柔的废话 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:09

    In Laravel 5.2

    Use Request and it's already present in the app file in the aliases array

    To retrieve original file name

    $request->file('upfile')->getClientOriginalName();
    

    To get file name without extension

    basename($request->file('upfile')->getClientOriginalName(), '.'.$request->file('upfile')->getClientOriginalExtension());
    
    0 讨论(0)
提交回复
热议问题