0
我在一个页面上有一个ASP.NET上传表单,用户可以上传图像。继承人对于一个代码:检索从ASP.NET页面上传的图像
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<html>
<head>
<script language="VB" runat="server">
Sub Button1_Click(sender As Object, e As EventArgs)
If imageupload1.HasFile Then
imageupload1.SaveAs(Server.MapPath(".") + "/uploadedimages/" & imageupload1.FileName)
Label1.Text = "Received " & imageupload1.FileName & " Content Type " & imageupload1.PostedFile.ContentType & " Length " & imageupload1.PostedFile.ContentLength
Else
Label1.Text = "No uploaded file"
End If
end sub
</script>
</head>
<body>
<form id="imguplad" runat=server>
<asp:FileUpLoad id="imageupload1" AlternateText="You cannot upload files" runat="server" />
<asp:Button id="Button1" Text="Upload" OnClick="Button1_Click" runat="server" />
<asp:Label id="Label1" runat="server" />
<input type="button" value="Click here when image is uploaded"
onClick="location.href='imageloadtest.aspx';">
</form>
</body>
</html>
然后我试图找回另一页上,使用下面的代码:
<%@ Page Language="C#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
...blah
<body>
<img id="image" src="Server.MapPath(".")+"/uploadedimages/"+Request.Form["imageupload1.FileName"]";">
</body>
...blah
似乎无法得到它的出现?我必须有一些小小的错误。
编辑:顺便说一下,图像上传完美,它只是不会显示在下一页。
没有运气这一点。即时通讯使用“。”在整个项目中,无论如何都应该是正确的?谢谢 – IceDragon 2010-07-29 13:49:11
哼哼抱歉,我在几秒钟之后改变了主意......我认为在aspx页面中应该如何使用代码不匹配...所以我更新了完整的'img'标签。 – 2010-07-29 13:51:08
似乎并不想工作,现在它只是不显示任何东西(即使是破碎的图片图标)。谢谢 – IceDragon 2010-07-29 13:56:11