简体   繁体   English

C# Base64 String 文件扩展名 mime 类型

[英]C# Base64 String file extension mime type

When I send a base64 string to an web api, do I need to pass the mime type eg jpg to define the file extension when the file is saved?当我向 web api 发送 base64 字符串时,是否需要传递 mime 类型(例如 jpg)来定义文件扩展名? if not how would I know what file type to save it as?如果不是,我怎么知道将它保存为什么文件类型?

您可以在单独的变量中发送文件类型,在 base64 字符串前面加上分隔符,然后提取它,或者将 base64 字符串转换为字节数组,然后读取前几个字节以确定图像格式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM