Server Error in '/' Application.
Could not find file 'C:\Program Files (x86)\IIS Express\2014-06-05 15.35.36.jpg'.
Description: An
unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not find file 'C:\Program Files (x86)\IIS Express\2014-06-05 15.35.36.jpg'.
Source Error:
Line 262: fil20.SaveAs(Server.MapPath("/images/@" + fil20.FileName));
Line 263: img20.ImageUrl = "/mages/@" + fil20.FileName;Line 264: FileStream fs = new FileStream(fil20.FileName, FileMode.Open, FileAccess.Read);Line 265: BinaryReader br = new BinaryReader(fs);
Line 266: FileInfo fn = new FileInfo(fil20.FileName); |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
the code is:::
<asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline" UpdateMode="Always">
<ContentTemplate>
<asp:Image ID="img20" runat="server" CssClass="lstpictemp"></asp:Image><asp:FileUpload ID="fil20" runat="server" /><asp:Button runat="server" ID="btnshare21" Text="Share" OnClick="btnshare21_Click" /><label id="lblnameimage20" runat="server">Name:</label><asp:TextBox
id="txtnameimage20" runat="server" EnableViewState="false"></asp:TextBox><label id="lbldescriptionimage20" runat="server">Description:</label><textarea id="txtdescriptonimage20" runat="server"></textarea>
</ContentTemplate>
<Triggers>
- <asp:PostBackTrigger ControlID="btnshare21" />
</Triggers>
</asp:UpdatePanel></div>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
protected void btnshare21_Click(object sender, EventArgs e)
{
fil20.SaveAs(Server.MapPath("/images/@" + fil20.FileName));
img20.ImageUrl = "/mages/@" + fil20.FileName;
FileStream fs = new FileStream(fil20.FileName, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
FileInfo fn = new FileInfo(fil20.FileName);
byte[] imgarr = br.ReadBytes((int)fn.Length);
DataManager.ExecuteNonQuery("uadvancedtemp", CommandType.StoredProcedure, DataManager.CreateParameter("@name", SqlDbType.NVarChar, txtnameimage.Text),
DataManager.CreateParameter("@discription", SqlDbType.NVarChar, txtdescriptonimage.Value), DataManager.CreateParameter("@image", SqlDbType.Image, imgarr));
fs.Close();
}
------------------------------------------------------------------------------------------------------------------------------------------------------
what should i do?