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.Pass (Send) BASE64 string to server side using jQuery AJAX in ASP.NetHi @bebins,<br />Please try the following<br /><br /><a href = 'link(Threads/102983/Pass-Send-Image-data-as-BASE64-string-using-jQuery-AJAX-in-ASPNet/)'>Pass (Send) Image data as BASE64 string using jQuery AJAX in ASP.Net</a><br /><br />It might help you.<br /><br />Cheers Andrea.https://www.aspforums.net:443/Threads/206285/Pass-Send-BASE64-string-to-server-side-using-jQuery-AJAX-in-ASPNet/https://www.aspforums.net:443/Threads/206285/Pass-Send-BASE64-string-to-server-side-using-jQuery-AJAX-in-ASPNet/Sat, 15 Jun 2019 08:08:10 GMTPass (Send) BASE64 string to server side using jQuery AJAX in ASP.Net<p>I will get back soon.</p>https://www.aspforums.net:443/Threads/206285/Pass-Send-BASE64-string-to-server-side-using-jQuery-AJAX-in-ASPNet/https://www.aspforums.net:443/Threads/206285/Pass-Send-BASE64-string-to-server-side-using-jQuery-AJAX-in-ASPNet/Mon, 17 Jun 2019 00:39:32 GMTPass (Send) BASE64 string to server side using jQuery AJAX in ASP.Net<p>Hi <a class="username" rel="bebins"> bebins</a>,</p> <p>Refer below sample.</p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <pre class="brush: html">&lt;script type=&#34;text/javascript&#34; src=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; $(function () { var fileName; $(&#34;input[type=file]&#34;).change(function (e) { var file = e.target.files[0]; fileName = e.target.files[0].name; var reader = new FileReader(); reader.onload = function (e) { $(&#39;#hfBase64&#39;).val(e.target.result); } if (file) { reader.readAsDataURL(file); } }); $(&#34;#btnUpload&#34;).on(&#34;click&#34;, function () { var base64 = $(&#34;#hfBase64&#34;).val(); var obj = {}; obj.data = base64; obj.name = fileName; $.ajax({ type: &#39;POST&#39;, url: &#39;Default.aspx/UploadFile&#39;, data: JSON.stringify(obj), contentType: &#39;application/json; charset=utf-8&#39;, dataType: &#39;json&#39;, error: function (e) { debugger; } }); }); }); &lt;/script&gt; &lt;div&gt; &lt;asp:HiddenField ID=&#34;hfBase64&#34; runat=&#34;server&#34; /&gt; &lt;asp:FileUpload ID=&#34;FileUpload1&#34; runat=&#34;server&#34; accept=&#34;application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&#34; /&gt; &lt;asp:Button Text=&#34;Upload&#34; runat=&#34;server&#34; ID=&#34;btnUpload&#34; /&gt; &lt;/div&gt;</pre> <p><span style="text-decoration: underline;"><strong>Namespaces</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.Web.Services;</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Imports System.Web.Services </pre> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">[WebMethod] public static void UploadFile(string data, string name) { string base64 = data.Replace(&#34;data:application/vnd.ms-excel;base64,&#34;, &#34;&#34;) .Replace(&#34;data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,&#34;, &#34;&#34;); // Saving Base64 string as file. System.IO.File.WriteAllBytes(HttpContext.Current.Server.MapPath(&#34;~/Files/&#34; + name), Convert.FromBase64String(base64)); }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">&lt;WebMethod()&gt; Public Shared Sub UploadFile(ByVal data As String, ByVal name As String) Dim base64 As String = data.Replace(&#34;data:application/vnd.ms-excel;base64,&#34;, &#34;&#34;).Replace(&#34;data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,&#34;, &#34;&#34;) &#39; Saving Base64 string as file. System.IO.File.WriteAllBytes(HttpContext.Current.Server.MapPath(&#34;~/Files/&#34; &amp; name), Convert.FromBase64String(base64)) End Sub</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/206285/Pass-Send-BASE64-string-to-server-side-using-jQuery-AJAX-in-ASPNet/https://www.aspforums.net:443/Threads/206285/Pass-Send-BASE64-string-to-server-side-using-jQuery-AJAX-in-ASPNet/Mon, 17 Jun 2019 05:18:38 GMT