here we go, just some simple upload code that uploads documents into a document library.
It also checks if the same file exist in the destination library before upload.

SPSite site = new SPSite(”http://mysharepointsite”);
SPWeb web = site.OpenWeb();
web.AllowUnsafeUpdates = true; // i always add this in to prevent security errors
Stream fStream = postedFile.InputStream;
byte[] contents = new byte[fStream.Length];
fStream.Read(contents, [...]