I have to do multiple upload of images (eg 5000 or more) to the server at once ..
can this be possible with a minimum of time ?
im using this code. but its taking more time ... for 400 images its taking 8-10 min...
is their any way to increase the performance??
protected void upload_btn_Click(object sender, EventArgs e)
{
Panel1.Visible = false;
try
{
fcount = 0;
totalcount = 0;
error_count = 0;
//Get the HttpFileCollection
System.Threading.Thread.Sleep(8000);
//byte[] imgbyte = null;
byte[] imgbyte = null;
HttpFileCollection hfc = Request.Files;
totalcount = hfc.Count;
writeToimage_LogFile();
for (int i = 0; i < hfc.Count; i++)
{
HttpPostedFile File = hfc[i];
imgbyte = new byte[File.ContentLength];
File.InputStream.Read(imgbyte, 0, (File.ContentLength));
DateTime date;
date = System.DateTime.Today;
filename = File.FileName;
int num;
num = search_duplicate(filename);
if (num == 2)
{
string image_name = File.FileName;
content_type=File.ContentType;
if (content_type != "application/pdf")
{
saveFolder = @"c:\v2docs\TempFiles";
filePath = Path.Combine(saveFolder, File.FileName);
File.SaveAs(filePath);
Convert_to_pdf();
save_to_server();
// delete_from_temp_file();
}
if (content_type == "application/pdf")
{
dataaccess2.imageUpload(imgbyte, image_name, content_type, date);
}
fcount += 1;
}
else
{
writeToimage_LogFile_error(filename);
}
Panel1.Visible = true;
}
string temp = string.Format("Upload Successfull...! {0}/{1} New Image(s) Uploaded.", fcount, totalcount);
writeToLogFile_status(temp);
string msg = string.Format("Upload Successfull...! {0}/{1} New Image(s) Uploaded.", fcount, totalcount);
HyperLink hplnk = new HyperLink();
hplnk.Text = "View Log";
hplnk.NavigateUrl = "ImageLogView.aspx";
string logmsg = "For more information";
hplnk.Target = "_blank";
log_lbl.Text = logmsg;
PlaceHolder1.Controls.Add(hplnk);
Label1.Text = msg;
}
catch
{
string msg1 = ("Image size is too large ");
Label2.Text = msg1;
}
}