Hi everyone,
i have to use two different Ajaxfileupload controls in a page .But when i upload file through second control the second event doesnot get fired(UploadComplete) everytime first event is fired.
<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
OnClientUploadComplete="onClientUploadComplete"
MaximumNumberOfFiles="10"
AllowedFileTypes="jpg,jpeg" OnUploadComplete="AjaxFileUpload1_UploadComplete" />
<asp:AjaxFileUpload ID="AjaxFileUpload2" runat="server"
OnClientUploadComplete="onClientUploadComplete1"
MaximumNumberOfFiles="10"
AllowedFileTypes="jpg,jpeg" OnUploadComplete="AjaxFileUpload2_UploadComplete" />
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs file)
{
if (file.ContentType.Contains("jpg") || file.ContentType.Contains("gif")
|| file.ContentType.Contains("png") || file.ContentType.Contains("jpeg"))
{
string filePath = @"C:\Desktop\\test\" + file.FileName;
AjaxFileUpload1.SaveAs(filePath);
}
}
protected void AjaxFileUpload2_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs file)
{
if (file.ContentType.Contains("jpg") || file.ContentType.Contains("gif")
|| file.ContentType.Contains("png") || file.ContentType.Contains("jpeg"))
{
string filePath = @"C:\Desktop\test1\" + file.FileName;
AjaxFileUpload2.SaveAs(filePath);
}
}