ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Display image after upload without page refresh or postback using ASP.Net AjaxFileUpload Control<p>Hi <a class="username" rel="nauna"> nauna</a>,</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <pre class="brush: html">&lt;%@ Register Assembly=&#34;AjaxControlToolkit&#34; Namespace=&#34;AjaxControlToolkit&#34; TagPrefix=&#34;asp&#34; %&gt; &lt;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&gt; &lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head runat=&#34;server&#34;&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id=&#34;form1&#34; runat=&#34;server&#34;&gt; &lt;asp:ScriptManager ID=&#34;ScriptManager1&#34; runat=&#34;server&#34;&gt; &lt;/asp:ScriptManager&gt; &lt;asp:AjaxFileUpload ID=&#34;AjaxFileUpload1&#34; runat=&#34;server&#34; MaximumNumberOfFiles=&#34;1&#34; OnUploadComplete=&#34;FileUploadComplete&#34; OnClientUploadComplete=&#34;uploadComplete&#34; /&gt; &lt;br /&gt; &lt;asp:Image ID=&#34;imgDisplay&#34; runat=&#34;server&#34; Style=&#34;display: none&#34; /&gt; &lt;script type=&#34;text/javascript&#34;&gt; function uploadComplete(sender, args) { var imgDisplay = $get(&#34;imgDisplay&#34;); imgDisplay.style.display = &#34;block&#34;; imgDisplay.style.cssText = &#34;height:100px;width:100px&#34;; imgDisplay.src = &#34;&lt;%=ResolveUrl(UploadFolderPath) %&gt;&#34; + args.get_fileName().substring(args.get_fileName().lastIndexOf(&#39;\\&#39;) + 1); } &lt;/script&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </pre> <p><strong><span style="text-decoration: underline;">Namespaces</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using AjaxControlToolkit; using System.IO;</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Imports AjaxControlToolkit Imports System.IO</pre> <p><strong><span style="text-decoration: underline;">Code</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">protected string UploadFolderPath = &#34;~/Uploads/&#34;; protected void FileUploadComplete(object sender, AjaxFileUploadEventArgs e) { string fileName = Path.GetFileName(e.FileName); AjaxFileUpload1.SaveAs(Server.MapPath(&#34;~/Uploads/&#34; + fileName)); }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Protected Sub FileUploadComplete(ByVal sender As Object, ByVal e As AjaxFileUploadEventArgs) Dim filename As String = Path.GetFileName(e.FileName) AjaxFileUpload1.SaveAs(Server.MapPath(&#34;~/Uploads/&#34;) + filename) End Sub</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><strong><span style="text-decoration: underline;"><img src="https://i.imgur.com/7xVxXzu.gif" alt="" width="249" height="336" /></span></strong></p>https://www.aspforums.net:443/Threads/813295/Display-image-after-upload-without-page-refresh-or-postback-using-ASPNet-AjaxFileUpload-Control/https://www.aspforums.net:443/Threads/813295/Display-image-after-upload-without-page-refresh-or-postback-using-ASPNet-AjaxFileUpload-Control/Fri, 14 Sep 2018 00:13:22 GMT