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.Save jpg on project folder instead of show to user<p>Please share your code</p>https://www.aspforums.net:443/Threads/137400/Save-jpg-on-project-folder-instead-of-show-to-user/https://www.aspforums.net:443/Threads/137400/Save-jpg-on-project-folder-instead-of-show-to-user/Mon, 30 May 2016 09:49:28 GMTSave jpg on project folder instead of show to user<p>&nbsp;</p> <pre class="brush: csharp">// here is the code protected void ExportToImage(object sender, EventArgs e) { string base64 = Request.Form[hfImageData.UniqueID].Split(&#39;,&#39;)[1]; byte[] bytes = Convert.FromBase64String(base64); Response.Clear(); Response.ContentType = &#34;image/png&#34;; Response.AddHeader(&#34;Content-Disposition&#34;, &#34;attachment; filename=HTML.png&#34;); Response.Buffer = true; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(bytes); Response.End(); }</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/137400/Save-jpg-on-project-folder-instead-of-show-to-user/https://www.aspforums.net:443/Threads/137400/Save-jpg-on-project-folder-instead-of-show-to-user/Mon, 30 May 2016 09:56:14 GMTSave jpg on project folder instead of show to user<p>Hi,</p> <p>Please refer below code</p> <p><span style="text-decoration: underline;">C#</span></p> <pre class="brush: csharp">string base64 = Request.Form[hfImageData.UniqueID].Split(&#39;,&#39;)[1]; byte[] bytes = Convert.FromBase64String(base64); File.WriteAllBytes(Server.MapPath(&#34;~/MyImage/ImageName.jpg&#34;),bytes);</pre> <p><span style="text-decoration: underline;">VB</span></p> <pre class="brush: vb">Dim base64 As String = Request.Form(hfImageData.UniqueID).Split(","C)(1) Dim bytes As Byte() = Convert.FromBase64String(base64) File.WriteAllBytes(Server.MapPath("~/MyImage/ImageName.jpg"), bytes)</pre> <p>I hope this will help you out.</p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/137400/Save-jpg-on-project-folder-instead-of-show-to-user/https://www.aspforums.net:443/Threads/137400/Save-jpg-on-project-folder-instead-of-show-to-user/Mon, 30 May 2016 09:58:33 GMTSave jpg on project folder instead of show to user<p>i have folder name "MyImage" in my project so this code will save the png on my folder shall i replace "Path" with "MyImage" ?</p>https://www.aspforums.net:443/Threads/137400/Save-jpg-on-project-folder-instead-of-show-to-user/https://www.aspforums.net:443/Threads/137400/Save-jpg-on-project-folder-instead-of-show-to-user/Mon, 30 May 2016 10:03:48 GMTSave jpg on project folder instead of show to user<p>Refer my previous reply i have modified it</p>https://www.aspforums.net:443/Threads/137400/Save-jpg-on-project-folder-instead-of-show-to-user/https://www.aspforums.net:443/Threads/137400/Save-jpg-on-project-folder-instead-of-show-to-user/Mon, 30 May 2016 10:07:00 GMT