当我将SVG上传到我的Symfony应用程序时,mimetype为text/html
但它应该是image/svg+xml
。我错过了在我的php中配置一些东西以检测正确的mimetype吗?
示例代码:
public function uploadAction(Request $request)
{
$uploadFile = $request->files->get($name);
$mimeType = $uploadedFile->getMimeType();
// or $mimeType = mime_content_type($uploadedFile->getPathname());
// both return "text/html" instead of "image/svg+xml"
return new Response($mimeType);
}
我使用了svg的Wiki示例来测试它:https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg