This is something really silly. Any list that is a part of a site can be accessed by using a small snippet that looks more or less like this:
SPSite site = new SPSite(http://localhost");
SPWeb web = site.OpenWeb();
SPList list = web.Lists[index];
Now lets say you want to add an item to an ordinary list. The snippet would go like:
..add the values for the individual fields...
If, however the list in question turns out to be a document library then you will be pleasantly surprised to see that the file you just added is nowhere to be seen. The catch lies in that a document library also supports folders. So the modification becomes:
The parameters in this case are the byte array containing the content of the file and the destination URL in terms of the root folder of the document library.