我使用以下代碼上傳檔案:
$this->form->file_path = $this->file->store('files/'.$this->file_name.'.pdf', 'public');
但無法正確設定檔案名。它使用隨機名稱將檔案存盤在 file_name.pdf 下。
uj5u.com熱心網友回復:
當您使用store()方法時,將為您生成檔案名。如果你想自己設定名字,你應該使用這個storeAs方法:
$this->file->storeAs('files', $this->file_name.'.pdf', 'public');
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/380505.html
