i want to upload multiple pdf files in one file upload control in asp.net and then merg it , this is already done when i pass static path and file name how to do that dynamically my code is here
if (FileUpload1.HasFile)
{
try
{
HttpFileCollection uploadedVideoFiles = Request.Files;
// Get the HttpFileCollection
for (int i = 0; i < uploadedVideoFiles.Count; i++)
{
HttpPostedFile hpfiles = uploadedVideoFiles[i];
string fname = Path.GetFileName(hpfiles.FileName);
if (hpfiles.ContentLength > 0)
{
hpfiles.SaveAs(Server.MapPath("~/Images/") + Path.GetFileName(hpfiles.FileName));
hpfiles.SaveAs(Server.MapPath(Path.Combine(@"~/Images/", fname)));
string filepath = Server.MapPath(@"~/Images/");
string path = filepath + fname;
}
}
String[] files = @"C:\ENROLLDOCS\A1.pdf,C:\ENROLLDOCS\[email protected]".Split(',');
MergeFiles(@"C:\ENROLLDOCS\New1.pdf", files);// merg is a method which merg 2 or more than 2 documents
}
catch (Exception ex)
{
Label1.Text = "The file could not be uploaded. The following error occured: " + ex.Message;
}
}