-4
问题是我设置图像URL单击lnkFV链接按钮。但图像不在页面上查看。
源上传一个视图图像
<tr>
<td style="width: 160px; height: 15px">
<asp:Label ID="Label4" runat="server" Text="Style Front View">
</asp:Label>
</td>
<td style="width: 222px; height: 15px">
<asp:FileUpload id="filFrontView" runat="server">
</asp:FileUpload>
</td>
<td style="width: 72px; height: 15px">
<asp:LinkButton id="lnkFV" runat="server" OnClick="lnkFV_Click">
View image</asp:LinkButton>
</td>
<td colspan="3" rowspan="1">
<asp:Image id="Image1" runat="server">
</asp:Image></td>
</tr>
ASP代码
protected void lnkFV_Click(object sender, EventArgs e)
{
// new Help().Perform("Do you really want to proceed");
try
{
file = Path.GetFileName(filFrontView.PostedFile.FileName);
// file = Path.GetFileName(filFrontView.PostedFile.FileName);
tempF = "F:\\Visual Studio 2005\\User\\temp\\" + file;
temp = "~\\temp\\" + file;
filFrontView.SaveAs(Server.MapPath(temp));
// filFrontView.SaveAs(temp);
string filePath = MapPath(temp);
Image1.ImageUrl = tempF;
}
catch (Exception ee)
{
}
}
什么是错误? – 2009-09-24 12:45:47
图像未查看。 – Suchinthaka 2009-09-24 12:47:59
您使用的是ASP.NET Ajax吗?该文件是否正确保存?你是否遇到异常?需要更多细节。 – 2009-09-24 12:49:08