I am using laravel 5 and there is a form which have to upload a document in it. The document is an excel type (xls and xlsx). The problem is when I am using a validation in laravel, some user cannot upload the document even when they upload an xls or xlsx file.
Here is my validation code in controller:
$validator = Validator::make($request->all(), [ 'tiket_tambahfileproposal' => 'mimes:pdf', 'tiket_tambahfilelkk' => 'mimes:xls,xlsx']); if ($validator->fails()) { return redirect ('/TiketProposal')->withErrors($validator)->withInput(); }
Code in my view is:
<input type="file" name="filename" accept="application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" required>
I think the problem is some user have an extention file (xls/xlsx) after the file name like this:
The file which does not have an extention at the end of the file name cannot be uploaded, the validator cannot read the xls and xlsx extention. Do you know how to solve this?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hSCjd5
via IFTTT
Aucun commentaire:
Enregistrer un commentaire