@sebasti4n Does your file field is allowing multiple files?
Oct 25, 2023
11
Level 8
"The file field is required" but it is present in $request->allFiles()?
I have a file upload form with enctype="multipart/form-data" that has this field:
<input type="file" name="file" id="file" required accept=".csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" />
When uploading, I have the following validation rule:
'file' => 'required|mimetypes:'.implode(',', [
'text/csv',
'text/plain',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.ms-excel',
'application/octet-stream',
]),
However, it fails with the error "The file field is required", but when I dd($request->allFiles()) there indeed is an array item called "file" which references an Illuminate\Http\UploadedFile instance.
What am I missing?
Please or to participate in this conversation.