brent265's avatar

Uploading a SVG file

How do I properly upload a svg file with Laravel 5.5? The standard image validation rule does not see it as a proper image (image|mimes:jpeg,png,jpg,gif,svg)

When I remove all validation, the file get's stored as a txt file.

0 likes
3 replies
lostdreamer_nl's avatar

An svg is actually more XML than an image (so yes, it's actually text).

The Intervention image library also doesnt support it, so if you need to edit the image you'll have to install the Imagick Image library.

The validation could be done by checking for mimetype instead of 'image':

mimes:jpeg,png,jpg,gif,svg

should work

brent265's avatar

The mime type seems to be ok, but the validation only on mime keeps failing. I'll do some more testing tomorrow.

Please or to participate in this conversation.