I have Ubuntu 18.04 and Laravel. In post method - upload file, I want to save parameters from upload files. At the begin I try to save something in the file:
public function settingsEdit($parameter)
{
file_put_contents('/tmp/aa.log', 'll');
return view('pages.account.settings.edit', ['user' => $this->user(), 'parameter' => $parameter]);
}
There is no error, but file isn't created. In tmp directory doesn't exists file aa.log.
file_put_contents()call. According to the docs: "This function returns the number of bytes that were written to the file, orFALSEon failure." You should consider reading the value returned byfile_put_contents()to ensure you are not receiving an error. For example:if(FALSE === file_put_contents('/tmp/aa.log', '11')) { exit("Error writing file!"); }