We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the src of an existing image by using UploadBox?

Platform: ASP.NET MVC |
Control: Uploadbox


You can change the source of image by using the complete event of UploadBox control.



Initially, you can render the image tag with the source of image as illustrated in the following code example.


    <img id="theimage" src="~/Image/car.png" alt="SrcImage"/>

Declare the complete event in UploadBox control as illustrated in the following code example.


@Html.EJ().Uploadbox("UploadDefault").SaveUrl("Upload/SaveDefault").RemoveUrl("Upload/RemoveDefault").ClientSideEvents(e => e.Complete("complete"))

The complete event triggers when the file upload progress is completed. To change the img tag src by a selected image from the UploadBox, use the complete event in the script section as illustrated in the following code example.


function complete(args)
$("#theimage").attr("src", "/Image/"+args.files.name);

The parameters passed in the argument of complete event is illustrated in the following API reference UG link.


2X faster development

The ultimate ASP.NET MVC UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile