LoginSignup
1

More than 5 years have passed since last update.

【PHP】リクエストでCSVファイルを受け取った場合にファイル名を取得する方法

Posted at

 はじめに

個人的メモ
でも結構手こずったし最終的には英語の文献に頼ったため日本語で残しておく

取得するもの

割り当てられたファイル名ではなく、ユーザーがアップロードするCSVに自分でつけたファイル名。
20181026売り上げ.csvみたいなやつ

方法


$csvFileName = $request->file('csv_file')->getClientOriginalName();//これで取れる

$csvFileName = $request->file('csv_file')->getFileName();//これと間違えがち

getClientOriginalNameで取れる!!

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1