0

I wont to display or preview image when its uploaded

my code is here :

Html.Label("Browse File", htmlAttributes: new { @class = "control-label col-md-2" })

              </div>
            <div class="col-sm-4">
                @Html.Label("Logo", htmlAttributes: new { @class = "control-label col-md-2" })
                <img src="FileUpload1" alt="Image" />
            </div>

1 Answer 1

0

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])">

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


      &lt;/div

>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.