I upload file with this code:
$this->form->file_path = $this->file->store('files/'.$this->file_name.'.pdf', 'public');
but cannot set the file name correctly. It stores file under file_name.pdf with a random name.
CodePudding user response:
When you use the store() method, the file name will generated for you. If you want to set the name yourself, you should use the storeAs
method:
$this->file->storeAs('files', $this->file_name.'.pdf', 'public');