Home > other >  Laravel i need validate field to check GPX or CSV files
Laravel i need validate field to check GPX or CSV files

Time:04-24

i need validate rule that will not block GPX/CSV files, and will block other files. i've tried mimes and mimetypes, and some combinations with the names of the files(gpx,.gpx,GPX,.GPX and the same for csv). My problem is what these combinations blocking all files including GPS/CSV.

Here is the example of my code:

'file' => ['required','file','mimes:jpg,csv']

CodePudding user response:

Found working solution on laravel 8 mimes:csv,txt,xml

CodePudding user response:

You can use :

'file' => ['required','file','mimetypes:text/csv,text/plain,application/xml,application/gpx xml']

or

'file' => ['required','file','mimes:csv,txt,xml,gpx']
  • Related