讨论asp.net的ajax的无刷新上传问题
<scriptsrc="../js/jquery.js"></script><script>$(function(){$('#fileUp').change(functi...
<script src="../js/jquery.js"></script>
<script>
$(function () {
$('#fileUp').change(function () {
$('#uploadLog').html('开始上传中....');
$("#frameMy").submit();
});
$("#mage").click(function () {
$("#fileUp").click();
});
});
function upResult(value) {
if (vales.split('|').length > 1) {
$("#ImageUrl").attr("src", "../image/UpLoad/" + vales.split('|')[1]);
}
else {
alert(value);
}
}
</script>
</head>
<body>
<form id="form1" runat="server" action="../Ajax/uploadPic.ashx" target="frameMy" method="post" enctype="multipart/form-data">
<div>
<input type="file" name="fileUp" id="fileUp" />
<input type="text" />
<img src="../image/back/9f1011b30f2442a74bb3f068d143ad4bd013027a.png" id="mage" />
<asp:Button ID="Button1" runat="server" Text="Button" />
<iframe name="frameMy" id="frameMy" style="display:none" ></iframe>
</div>
</form>
为什么submit没有效果,提交不到一般处理程序?
string pic = context.Request["picUrl"];
//string[] a = pic.Split('\\');
string b = DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
string path = context.Server.MapPath("~/image/UpLoad/");
path += b;
File.Copy(pic, path, true);
context.Response.Write(b);
context.Response.End();
这样子上传有什么坏处咩? 展开
<script>
$(function () {
$('#fileUp').change(function () {
$('#uploadLog').html('开始上传中....');
$("#frameMy").submit();
});
$("#mage").click(function () {
$("#fileUp").click();
});
});
function upResult(value) {
if (vales.split('|').length > 1) {
$("#ImageUrl").attr("src", "../image/UpLoad/" + vales.split('|')[1]);
}
else {
alert(value);
}
}
</script>
</head>
<body>
<form id="form1" runat="server" action="../Ajax/uploadPic.ashx" target="frameMy" method="post" enctype="multipart/form-data">
<div>
<input type="file" name="fileUp" id="fileUp" />
<input type="text" />
<img src="../image/back/9f1011b30f2442a74bb3f068d143ad4bd013027a.png" id="mage" />
<asp:Button ID="Button1" runat="server" Text="Button" />
<iframe name="frameMy" id="frameMy" style="display:none" ></iframe>
</div>
</form>
为什么submit没有效果,提交不到一般处理程序?
string pic = context.Request["picUrl"];
//string[] a = pic.Split('\\');
string b = DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
string path = context.Server.MapPath("~/image/UpLoad/");
path += b;
File.Copy(pic, path, true);
context.Response.Write(b);
context.Response.End();
这样子上传有什么坏处咩? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询