Tapas Bose
Tapas Bose

Reputation: 29816

Get Filename from Byte Array

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

Is it possible to get Filename from Byte Array.

Upvotes: 4

Views: 7769

Answers (2)

Lukas Eder
Lukas Eder

Reputation: 221106

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

Upvotes: 1

Thilo
Thilo

Reputation: 262724

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

Upvotes: 6

Related Questions