M
Mukesh
i have coded like this
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server">
<asp:FileUpload ID="fupLogo" runat="server" Visible="False">
<asp:Button ID="Button2" runat="server" Text="Upload"
OnClick="Button2_Click" Visible="False" />
</asp:FileUpload><asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="show Uploader " />
</ContentTemplate>
<Triggers>
<aspostBackTrigger ControlID="Button2">
</aspostBackTrigger>
</Triggers>
</asp:UpdatePanel>
code behind>>>>>>>>>>>>>>>>>>>
protected void Button2_Click(object sender, EventArgs e)
{
if (fupLogo.HasFile)
{
string fileFormat = fupLogo.PostedFile.ContentType;
Label1.Text = fupLogo.PostedFile.ContentType;
if (string.Compare(fileFormat, "image/jpeg", true) == 0 ||
string.Compare(fileFormat, "image/png", true) == 0 ||
string.Compare(fileFormat, "image/gif", true) == 0)
{
Label1.Text += "file format supported<br/>";
}
else
{
Label1.Text +="file format not supported<br/>";
}
}
else
{
Label1.Text += "file not exist<br/>";
}
}
protected void Button1_Click(object sender, EventArgs e)
{
fupLogo.Visible = true;
Button2.Visible=true;
}
this behaves like on page load it shows a button then the onclick of the
button it shows a fileupload and upload button
Expected: when i cliks upload button after selecting any file
ouput must be "file format supported/not suported"
actual: but the output is "file not exist".
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server">
<asp:FileUpload ID="fupLogo" runat="server" Visible="False">
<asp:Button ID="Button2" runat="server" Text="Upload"
OnClick="Button2_Click" Visible="False" />
</asp:FileUpload><asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="show Uploader " />
</ContentTemplate>
<Triggers>
<aspostBackTrigger ControlID="Button2">
</aspostBackTrigger>
</Triggers>
</asp:UpdatePanel>
code behind>>>>>>>>>>>>>>>>>>>
protected void Button2_Click(object sender, EventArgs e)
{
if (fupLogo.HasFile)
{
string fileFormat = fupLogo.PostedFile.ContentType;
Label1.Text = fupLogo.PostedFile.ContentType;
if (string.Compare(fileFormat, "image/jpeg", true) == 0 ||
string.Compare(fileFormat, "image/png", true) == 0 ||
string.Compare(fileFormat, "image/gif", true) == 0)
{
Label1.Text += "file format supported<br/>";
}
else
{
Label1.Text +="file format not supported<br/>";
}
}
else
{
Label1.Text += "file not exist<br/>";
}
}
protected void Button1_Click(object sender, EventArgs e)
{
fupLogo.Visible = true;
Button2.Visible=true;
}
this behaves like on page load it shows a button then the onclick of the
button it shows a fileupload and upload button
Expected: when i cliks upload button after selecting any file
ouput must be "file format supported/not suported"
actual: but the output is "file not exist".