How upload mime type in javascript

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. Now i want in javascript. means client site.

protected void Button1_Click(object sender, EventArgs e)
{
System.IO.BinaryReader r = new System.IO.BinaryReader(FileUpload2.PostedFile.InputStream);
string fileclass = "";
byte buffer;
try
{
buffer = r.ReadByte();
fileclass = buffer.ToString();
buffer = r.ReadByte();
fileclass += buffer.ToString();
}
catch
{
}
r.Close();
if(fileclass!="3780")
{
ltl_status.Text = "<p>Error - The upload file must be in PDF format.</p>"
return;
}
}