AsyncUpload_FileUploaded preview for <img />?

1 posts, 0 answers
  1. RJ
    RJ avatar
    395 posts
    Member since:
    Oct 2006

    Posted 02 Sep 2016 Link to this post

    Hi All,

    Reason why I wanted to preview it with img tag for I have a special CSS that is attached to it (I have no issue when I preview it with RadImageEditor).

    <script type="text/javascript">
        var imageUploaded = false;
        function OnClientFilesUploaded(sender, args) {
          $find('<%=RadAjaxManager1.ClientID %>').ajaxRequest();
          imageUploaded = true;


    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="false">
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
             <telerik:AjaxUpdatedControl ControlID="imgProfile" />


    <img id="imgProfile" runat="server" alt="Profile" src="..\default.jpg" />
    <telerik:RadAsyncUpload ID="AsyncUpload1" runat="server"
      MaxFileSize="1024000" AllowedFileExtensions="jpg,png,gif,bmp"
      AutoAddFileInputs="false" Localization-Select="Upload" />

    Protected Sub AsyncUpload1_FileUploaded(sender As Object, e As FileUploadedEventArgs)
            Using stream As Stream = e.File.InputStream
                Dim imgData As Byte() = New Byte(stream.Length - 1) {}
                stream.Read(imgData, 0, imgData.Length)
                Dim ms As New MemoryStream()
                ms.Write(imgData, 0, imgData.Length)
                Context.Cache.Insert(Session.SessionID + "UploadedFile", ms, Nothing, DateTime.Now.AddMinutes(20), TimeSpan.Zero)
            End Using
    ''Code for updating Img src???
        End Sub


    I did try to save first the file to a folder and then use the path for the img src but its not reflecting. I still need to do refresh just to make my img update its image.

    I hope anyone can suggest for better solution.


    Thanks in advance,


Back to Top