how to loop filename when saving filename in db

Mar 24, 2012 at 1:03 PM

hi

I have a problem i have a comment table and attachment table

for each comment there can be more than 5 attachments(files to be uploaded through ajax fileupload)

i want to save attachments when at least one comment is uploaded in the db

now when i want to save a comment how can i loop filenames in fileupload ajax and save it to db

regards

khurram

Mar 26, 2012 at 11:19 AM

I found out by

aspx

 <cc1:FileUploaderAJAX ID="FUA" runat="server" MaxFiles="20" text_Add="Add New File" File_RenameIfAlreadyExists="true"
                text_X="Cancel" text_Uploading="File Uploading..." />

 

c#

Att is dat class for saving in table

for (int i = 0; i <= FUA.historial.Count - 1; i++)
                {
                    if (FUA.historial[i].Deleted == false && FUA.historial[i].Saved)
                        ATT.AddNew();
                    ATT.MessageId = tc.MessageId;                
                    ATT.FileName = FUA.historial[i].FileName;
                    ATT.AttachmentDate = DateTime.Now;
                    ATT.Save();
                }