Hi,
I have a property of a Model that stores into DB the path of an image, by example “/Users/fr112/Documents/App/Public/AA57DDF1-7387-4A01-B296-BFB0C0B26187.png”.
When I try to save this data into the column “logo” of my table, this is the error that I obtain: “[ ERROR ] MySQLError.server (1366): Incorrect string value: ‘\xCC\x81s/Ge…’ for column ‘logo’ at row 1 (/Users/fr112/Documents/App/.build/checkouts/mysql.git-1890032512239690518/Sources/MySQL/Connection/MySQLConnection.swift:90)”
What I do into my code is this:
> // Subimos la imagen al directorio
> let fileManager = FileManager()
> fileManager.createFile(atPath: dir, contents: logo, attributes: nil)
> colegio.logo = dir
> print(colegio.logo)
>
> // Actualizamos la ruta de la imagen
> return colegio.save(on: req).map(to: Response.self) { updatedColegio in
> return req.redirect(to: “colegios”)
> }
Finally, this is the struct of my table:
Where can be the error?
Thanks!