How to uploadfile?

How to uploadfile?

I have used the API To insertrecord.  From the response, I use the the record Id of the Lead. Now I want to attach a document to the record from my desktop. I get this error ' 4424 Unable to process your request. Please verify whether you have provided proper file. '.  I am trying to upload a pdf. I am using C#. I am not sure how to pass the 'Content' as file input stream. Any sample code in C# will be helpful.