I am using formvalidation.io to validate my form. but I have a problem in validating image files and pdf files in one input.
try changing it here
fields: {
fileupload: {
validators: {
file: {
extension: 'jpeg,jpg,png,pdf',
type: 'image/jpeg, image/png, application/pdf',
maxSize: 5 * 1024 * 1024, // 5 MB
message: 'The selected file is not valid, it should be (jpeg,jpg,png,pdf) and 5 MB at maximum.'
}
}
}
}
with a format like that.
it can only upload jpg files, am I doing something wrong ?
fields: {
fileupload: {
validators: {
file: {
extension: 'png,jpg,jpeg,pdf',
type: 'image/png,image/jpeg,application/pdf,',
maxSize: 5 * 1024 * 1024, // 5 MB
message: 'The selected file is not valid, it should be (png,jpg,jpeg,pdf) and 5 MB at maximum.'
}
}
}
}
I think the problem is space after comma, if no space after comma it works