how to read an image file in asp.net c# using asp:fileupload? -


i used code below upload image. please let me know why code not work @ all. using updatepanal , multiview control tab controlling.

<asp:fileupload id="fuphoto" runat="server"/> <div style="margin-top:20px;text-align:center;">     <asp:button id="btnaddmemberinfo" runat="server" text="add" width="100px" onclick="btnaddmemberinfo_click" />                                 </div>  public byte[] getphtostream()             {                 byte[] bufferphoto = new byte[fuphoto.postedfile.contentlength];                 stream photostream = fuphoto.postedfile.inputstream;                 photostream.read(bufferphoto, 0, fuphoto.postedfile.contentlength);                 return bufferphoto;             } protected void btnaddmemberinfo_click(object sender, eventargs e)         {   photo = getphtostream(); //photo represent database field datatype image } 

fileupload doesn't work in updatepanel ajax postbacks. work have register btnmemberinfo postbacktrigger full postback. it'll work.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -