Get Filename from Byte Array

六眼飞鱼酱① 提交于 2019-12-12 19:53:58

问题


We can extract the mimetype from byte array, e.g., by using Apache Tika.

Is it possible to get Filename from Byte Array.


回答1:


No. You can take a guess at a mimetype from the content data itself, but the filename is not in there.




回答2:


The header field that you may be looking for is called Content-Disposition. If you're downloading an attachment, then there may be a file name in that field:

Content-Disposition: attachment;filename=abc.txt

But there's no guarantee that you'll have such a file name available. Also, this may only apply to HTTP and E-Mail content. From your question, it's not clear where your data's origin is...



来源:https://stackoverflow.com/questions/9884908/get-filename-from-byte-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!