且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在ASP.NET mvc5中上传图像时显示图像

更新时间:2023-02-24 12:52:24

我的问题解决了Thant's

这里我的代码

my problem is solved Thant's
here my code
@Html.Label("Browse File", htmlAttributes: new { @class = "control-label col-md-2" })
                  <div class="col-sm-4">
                      <input type="file" id="FileUpload1" class="form-control"  onchange="document.getElementById('logoImage').src = window.URL.createObjectURL(this.files[0])">

                  </div>
                   <div class="col-sm-4">
                       @Html.Label("Logo Image", htmlAttributes: new { @class = "control-label col-md-2"})
                       <img id="logoImage" src="FileUpload1" alt="Logo Image" width="100" height="100" style="border:1px ;margin-top:20px; margin-left:120px;" />
                       </div>