This code creates a new listitem for every attachment but i only want to create 1 listitem and add all attachments to it
SPList myEmployeeDocList = web.Lists.TryGetList("Document cv");
if (myEmployeeDocList != null)
{
SPListItem employeeDocListItem = myEmployeeDocList.Items.Add();
employeeDocListItem["Title"] = strUserName;
if (FileUploadDocuments.PostedFile != null && FileUploadDocuments.HasFile)
{
Stream fStream = FileUploadDocuments.PostedFile.InputStream;
byte[] empDocContents = new byte[fStream.Length];
fStream.Read(empDocContents, 0, (int) fStream.Length);
fStream.Close();
fStream.Dispose();
SPAttachmentCollection empDocAttachment = employeeDocListItem.Attachments;
string empDocFileName = Path.GetFileName(FileUploadDocuments.FileName);
empDocAttachment.Add(empDocFileName, empDocContents);
}
employeeDocListItem.Update();
string empDocListUrl = web.Url + "/" + myEmployeeDocList.RootFolder.Url;
string empDocAttachmentUrl = empDocListUrl + "/attachments/" + employeeDocListItem.ID + "/" +
FileUploadDocuments.FileName;
//.... cut ....