I'm working with a webpart and saving the data to a SPList. I also got two fileUpload controls and i want to upload a picture to a picture library and a document to a document library. Is that possible? And how to? Was googling around but really don't have a clue how to. I also want them to connection with other, for example, if i save the Picture to the librar i want the picture to display it's title, and not the picture url title.

This is the code i'm using when i'm uploading the image to a picture library:

        byte[] imageData = null;
{
{
long iLength = MyStream.Length;
imageData = new byte[(int)MyStream.Length];
MyStream.Close();
SPPictureLibrary pic = (SPPictureLibrary)SPContext.Current.Web.Lists["Picture library"];//Images is the picture library name
SPFileCollection filecol = ((SPPictureLibrary)SPContext.Current.Web.Lists["Picture library"]).RootFolder.Files;//getting all the files which is in pictire library

}
}


You can do the exact same thing with the document, but instead of using a SPPictureLibrary object, just call add on the Web.Files object and create the path to the library by using the web's url, library name, and the file name you want to appear as in the library.