如何更新文件上传中的图像? [英] How to Update image in file upload ?
本文介绍了如何更新文件上传中的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何更新数据表中的图像?使用文件上传
How to Update image in data table? Using file upload
推荐答案
<![CDATA[<%@ Page Language="C#" %>]]>
<script runat="server">
protected string uploadedImgPath;
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
uploadedImgPath = "/images/" + FileUpload1.FileName;
FileUpload1.SaveAs(Server.MapPath(uploadedImgPath));
}
else
{
emptyupload.Text = "Choose your file";
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
font-size: larger;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="auto-style1">
Pick Your file from file upload control<br />
<asp:fileupload id="FileUpload1" runat="server" xmlns:asp="#unknown" />
<br />
<br />
<asp:button id="Button1" runat="server" onclick="Button1_Click" text="Save" xmlns:asp="#unknown" />
<br />
<asp:label id="emptyupload" runat="server" xmlns:asp="#unknown"></asp:label>
</div>
</form>
<p>
Your Uploaded Image</p>
<img src="<%=uploadedImgPath%>" />
</body>
</html>
请参阅Google的所有示例朋友..
https://www.google.co.in/search?
noj = 1& q = update + new + imag E +从+文件上传+ + asp.net&安培; gs_l = serp.3.0.33i21.1939.2494.0.4181.3.3.0.0.0.0.340.607.1j0j1j1; OQ =更新+新+ +从文件上传+ +作为&安培图像+。 3.0 .... 0 ... 1c.1.35.serp..2.1.340.jHmlU5lmoWU [ ^ ]
这篇关于如何更新文件上传中的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文