js代码 function submitform() { $("#form_upload").ajaxSubmit({ success: showResponse }); } function showResponse(responseText) { if (responseText != null) { alert('上传成功!'); } else { alert('操作失败!'); } } $(function () { $("#upImg").on("change", function () { var file = this.files[0]; if (this.files && file) { var reader = new FileReader(); reader.onload = function (e) { $('#result').attr('src', e.target.result); } reader.readAsDataURL(file); } }); })
前台代码
生产(经营)许可证证件照片 | |
后台代码 [HttpPost] public ActionResult Upload(HttpPostedFileBase upImg) { if (upImg == null) { return Content("文件上传错误,请重新选择文件!"); } string fileName = System.IO.Path.GetFileName(upImg.FileName); string filePhysicalPath = Server.MapPath("~/credp_w_picpaths/" + fileName); try { upImg.SaveAs(filePhysicalPath); Session["ImgPath"] = filePhysicalPath; return Content("上传成功"); } catch { return Content("上传异常 !"); } }
售后响应及时
7×24小时客服热线数据备份
更安全、更高效、更稳定价格公道精准
项目经理精准报价不弄虚作假合作无风险
重合同讲信誉,无效全额退款