I modified the code. I can now upload to current document library (not more hardcoding the document library or the acutal url). All i need to do now is to make sure folder exists or not. create folder if it does not exists in the current document library. I will continue to update the code if I came across the solution.
Thanks
public override void ItemAdded(SPItemEventProperties properties)
{
base.ItemAdded(properties);
using (SPSite currentSite = new SPSite(properties.WebUrl))
using (SPWeb currentWeb = currentSite.OpenWeb())
{ SPListItem oItem = properties.ListItem;
string doclibname = "Not a doclib";
//Gets the name of the document library
SPList doclibList = oItem.ParentList;
if (null != doclibList)
{
doclibname = doclibList.Title;
}
// this section also not working.
// getting Object reference not set to an instance of an object or something like that.
//if (currentWeb.GetFolder("uHippo").Exists == false)
//{
SPListItem folder = doclibList.Folders.Add(doclibList.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder, "uHippo");
folder.Update();
//}
}
}