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; }</script>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="false"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="imgProfile" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings></telerik:RadAjaxManager>
<img id="imgProfile" runat="server" alt="Profile" src="..\default.jpg" /><telerik:RadAsyncUpload ID="AsyncUpload1" runat="server" OnClientFilesUploaded="OnClientFilesUploaded" OnFileUploaded="AsyncUpload1_FileUploaded" 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,
RJ