4

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

Is it possible to get Filename from Byte Array.

2
  • @Joey Honestly I haven't tried any thing. I searched Google but didn't find a way to solve it. Commented Mar 27, 2012 at 7:18
  • How did you get the byte array? Only that makes all the difference! Commented Mar 27, 2012 at 10:18

2 Answers 2

6

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

Sign up to request clarification or add additional context in comments.

Comments

1

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...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.