Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6028903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:48:29+00:00 2026-05-23T04:48:29+00:00

I am exposing a WCF service which allows a third party to upload files.

  • 0

I am exposing a WCF service which allows a third party to upload files. It has been open until now as to what files you can upload as this is the first phase, but for phase two I might have to increase security.

Is there an easy way in C# of verifying that a file is firstly not an exe, and that the file contents matches the extension?

I have logged the files that people have uploaded, and the first handful of bytes, and so far have come up with some info like this,

pdf 25 50 44 46 2D 31 2E
jpg FF D8 FF E0 00 10 4A 46 49 46 00 01
doc D0 CF 11 E0 A1 B1 1A E1 00 00 00 00 

etc. Is it a fixed number of bytes that determine what file type it is? Also is there a list of this type of data around.

Do I need to take the data I collect above and roll my own C# code to check the file, or are there existing libraries or code samples that do what I am after?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:48:30+00:00Added an answer on May 23, 2026 at 4:48 am

    This seems quite good,

    http://www.astro.keele.ac.uk/oldusers/rno/Computing/File_magic.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a WCF service which, at the moment, exposing a number of contracts
A WCF service exposing multiple elements in DataContract as DataMember [DataMember(IsRequired = true, EmitDefaultValue
I have a wcf service thats exposing a service using two endpoints. One endpoint
I have a class property exposing an internal IList<> through System.Collections.ObjectModel.ReadOnlyCollection<> How can I
We've added performance measures to our application and are exposing them using JMX. Now
I have a Windows Service which is basically accessing a mailbox and reading the
I have created an OData/WCF service using Visual Studio 2010 on Windows XP SP3
I have a 2 WCF services that are exposing the same object. Lets say
I have a RESTful service that I am developing in WCF . I am
I have a simple question which propably has a difficult answer, but what is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.