react-hook-form pattern for an input file

Viewed 48

I am wondering if I can use the pattern for input file to check the extension with a regex. I know it works fine with an input text but I cannot make it work with an input file.

rules={{
    required: requiredField(watch, fld),
    pattern: {
    value: /\.(gif|jpe?g|png|jpg)$/i,
    message: 'invalid File Type',
 }}}
0 Answers
Related