I Have Created an Fileupload with the following code.
if (FileUpload_Pic.PostedFile != null && FileUpload_Pic.HasFile)
{
Stream fStream = FileUpload_Pic.PostedFile.InputStream;
byte[] contents = new byte[fStream.Length];
fStream.Read(contents, 0, (int)fStream.Length);
fStream.Close();
fStream.Dispose();
SPAttachmentCollection attachments = item.Attachments;
string fileName = Path.GetFileName(FileUpload_Pic.PostedFile.FileName);
attachments.Add(fileName, contents);
//listItem["Attached FileName"] = fileName; // store the name of the file in a column for future requirements
item.Update();
}
That saves an picture attachments to an SPlist I Have also created an Textbox there i search in the SPList for the ProductsNumber , but would also like to add an attachments in the listbox , but i dont really know , how to make it...