从Base64字符串获取文件扩展名 [英] Get File Extention from Base64 String

查看:6440
本文介绍了从Base64字符串获取文件扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我想从ASP.NET中的Base64String获取文件类型(文件扩展名)



我有web方法,其中我已经通过1)Base64字符串和2)文件名与文件扩展名

但现在我想通过1)Base64字符串和2)只有文件名(没有扩展名)



所以我可以从该Base64字符串获得该扩展名/我如何获得该base64编码文件的扩展名。



谢谢。

解决方案

除非扩展包含在转换为base64的数据中,否则你可能可以't。

可以 可以查看数据并确定它是否属于少数类型之一,但是取决于你要检查的类型,以及它们各自的数据格式。



没有通用数据部分说这个二进制数据是xxx类型(那个是文件扩展名是什么)

Hi All,

I wanted to get File type (File Extension) from Base64String in ASP.NET

I have web method in which I have passed 1) Base64 string and 2) File Name with File Extension
but now I wanted to Pass 1) Base64 String and 2) Only File Name (Without Extension)

So Can I get that Extension from that Base64 String / how can i get that base64 Encoded File's Extension.

Thanks.

解决方案

Unless the extension is contained within the data converted to base64, then no, you probably can't.
It may be possible to look at the data and decide if it is one of a small range of types, but that will depend on the types that you are checking for, and their individual data formats.

There is no generic data section which says "this binary data is xxx type" (that is what the file extension is there for)


这篇关于从Base64字符串获取文件扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆