I’ve noticed when I click submit without having selected a file the error message given back is, for example:
The extensions for “28069609” is missing
As I understand it the controller gives a unique number to prefix the filename to hinder opening of malicious uploads. But this is messing with the error check as it’s creating a filename for a file that isn’t there, without an extension.
It would make more sense to the user if the error message given was “No file selected”. How can I most easily fix this? Do I need a check in place before the file name appending happens?
So would it look something like this? I’m still pretty new to php so forgive me if this is dumb
if (count($uploads) > 3) {
$alerts['exceedMax'] = 'You may only upload 3 files.';
return compact('alerts', 'success');
}
if (count($uploads) == 0) {
$alerts['noFile'] = 'You have not selected a file.';
return compact('alerts', 'success');
}
This is still returning the same error so I’m guessing I’ve done it incorrectly.