I am developing an app where a user uploads PDF files to the server, via a FileUpload control.
As part of the usual security/reliability checks I wanted to verify that the uploaded document was actually a PDF, not just say, a Text file renamed to have a .PDF extension.
I thought this might work:
If Not FileUploadControl.PostedFile.ContentType.ToLower = "application/pdf" Then
ltl_status.Text = "<p>Error - The upload file must be in PDF format.</p>"
Exit Sub
End IfThe above code however is fooled if I rename a Text file with a PDF extension and upload it. Is there anyway to actually check the real type of the file instead of just presuming the file extension is accurate?
...
Go to the complete details ...