I'm trying to filter the upload of a file through the form. The type of file I work with is .gpx (gps positions). Internally it is an xml file, but its mimetype is application / gpx + xml.
I have put the following in the validation.yml file about the route entity:
AppBundle\Entity\Route:
properties:
pointsFile:
- NotBlank: ~
- File:
mimeTypes: "application/gpx, application/gpx+xml"
disallowEmptyMessage: "Required"
uploadErrorMessage: The file could not be uploaded
The property that represents the file is pointsFile .
When I upload a .gpx file, it shows me the error message:
El tipo mime del archivo no es válido ("application/xml"). Los tipos mime válidos son "application/gpx, application/gpx+xml".
The .gpx format is actually an xml. From what I see when uploading a file it identifies it as xml and throws me the error. What I want to achieve is to only upload correct .gpx files, and if it is another error file (both xml and not)
Does anyone know how to force this guy? Or should I make a constraint of my own to evaluate the content first ???