Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF File Detected as plain/text #35

Open
caglabaran opened this issue Feb 25, 2021 · 0 comments
Open

PDF File Detected as plain/text #35

caglabaran opened this issue Feb 25, 2021 · 0 comments

Comments

@caglabaran
Copy link

caglabaran commented Feb 25, 2021

Hi,

I have tried to detect a 'pdf' file but I got 'txt' as a response

IFormFileCollection invoices
       
foreach (var invoice in invoices)
{
    using (var ms = invoice.OpenReadStream())
    {
        FileType fileType = ms.GetFileType();
    }
}

The file bytes starting with 25 50 44 46 and it should be acceptable as pdf

The pdf file bytes are starting with these:

25 50 44 46 2d 31 2e 37 0a 25 ef bf bd ef bf bd ef bf bd ef bf bd 0a 31 20 30 20 6f 62 6a 0a 3c 3c 2f 54 79 70 65 2f 43 61 74 61 6c 6f 67 2f 50 61 67 65 73 20 32 20 30 20 52 2f 4c 61 6e 67 28 74 72 2d 54 52 29 20 2f 53 74 72 75 63 74 54 72 65 65 52 6f 6f 74 20 31 30 20 30 20 52 2f 4d 61 72 6b 49 6e 66 6f 3c 3c 2f 4d 61 72 6b 65 64 20 74 72 75 65 3e 3e 2f 4d 65 74 61 64 61 74 61 20 32 31 20 30 20 52 2f 56 69 65 77 65 72 50 72 65 66 65 72 65 6e 63 65 73 20 32 32 20 30 20 52 3e 3e 0a 65 6e 64 6f 62 6a 0a 32 20 30 20 6f 62 6a 0a 3c 3c 2f 54 79 70 65 2f 50 61 67 65 73 2f 43 6f 75 6e 74 20 31 2f 4b 69 64 73 5b 20 33 20 30 20 52 5d 20 3e

.Net Core Project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant