0
客戶端發送文件到服務器。它看起來像這樣:如何處理Laravel中的文件?
array:1 [▼
"file" => array:5 [▼
"name" => "MMM1(one row).TXT"
"type" => "application/octet-stream"
"tmp_name" => "/tmp/phpaKnJzE"
"error" => 0
"size" => 1365
]
]
如果做如下操作:
dd($_FILES);
我試圖處理類似THI文件:
foreach ($_FILES["file"] as $file) {
$file->store('tests');
$file->getClientOriginalName();
}
但它不爲我工作。
它involke一個錯誤:在陣列
$this->file->getClientOriginalName()
嘗試閱讀有關處理文件的Laravel文檔:https://laravel.com/docs/master/requests#files –