How to view and download particular file from db in asp.netPaul Rajs11yAsked Jan 4, 2016, 8:38 PM ESTSolvedShareLinkedInXCopy linkSavei want to view and download particular file whish is stored in database in asp.net
How to view and download particular file from db in asp.netPaul Rajs11yAsked Jan 4, 2016, 8:38 PM ESTSolvedShareLinkedInXCopy linkSavei want to view and download particular file whish is stored in database in asp.net
Arul RRank #2,478 · 566 reputation11y agoPosted Jan 4, 2016, 9:20 PM EST✓ Accepted answer0Paul Raj, Kindly refer the below links, Hope this will solve your problem.http://www.aspsnippets.com/Articles/Upload-and-Download-files-from-SQL-Server-Database-in-ASPNet.aspxhttp://www.codeproject.com/Articles/308552/Upload-and-Download-Files-to-SQL-Servers-in-ASP-Nehttp://www.codeproject.com/Questions/380226/How-to-download-upload-particular-file-in-ASP-NETLet me know for any thing more....If your problem solved means kindly Accept my answer0Sandy SurwaseRank #8,477 · 221 reputation11y agoPosted Jan 4, 2016, 9:20 PM EST0 string binaryImageQuery =String.Format(@" ",_customEntityName.ToLower()); EntityCollection binaryImageResults = _serviceProxy.RetrieveMultiple(new FetchExpression(binaryImageQuery)); Console.WriteLine("Records retrieved and image files saved to: {0}", Directory.GetCurrentDirectory()); foreach (Entity record in binaryImageResults.Entities) { String recordName = record["sample_name"] as String; String downloadedFileName = String.Format("Downloaded_{0}", recordName); byte[] imageBytes = record["entityimage"] as byte[]; var fs = new BinaryWriter(new FileStream(downloadedFileName, FileMode.Append, FileAccess.Write)); fs.Write(imageBytes); fs.Close(); Console.WriteLine(downloadedFileName); CodeCopyaccept the answer if its helpful for you0Rajeesh MenothRank #118 · 18.4K reputation11y agoPosted Jan 4, 2016, 9:22 PM EST0Hi, Check the following reference : Video Tutorial : https://www.youtube.com/watch?v=-fkdrgFiaeI Other Reference : http://www.aspsnippets.com/Articles/Upload-and-Download-files-from-SQL-Server-Database-in-ASPNet.aspx http://www.aspdotnet-suresh.com/2013/01/aspnet-download-and-upload-files-to.html http://www.aspsnippets.com/Articles/Retrieve-and-display-PDF-Files-from-database-in-browser-in-ASPNet.aspx 0Ankur MistryRank #86 · 23.9K reputation11y agoPosted Jan 4, 2016, 10:39 PM EST0Hi,Check : http://www.aspsnippets.com/Articles/Upload-and-Download-files-from-SQL-Server-Database-in-ASPNet.aspx 0Paul RajsRank #2,423 · 582 reputation11y agoPosted Jan 6, 2016, 1:13 AM EST0Thanks a lot for all of your reply, i can able to accept only one answer, So i can't able accept all of your answers. Paul.S 0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sandy SurwaseRank #8,477 · 221 reputation11y agoPosted Jan 4, 2016, 9:20 PM EST0 string binaryImageQuery =String.Format(@" ",_customEntityName.ToLower()); EntityCollection binaryImageResults = _serviceProxy.RetrieveMultiple(new FetchExpression(binaryImageQuery)); Console.WriteLine("Records retrieved and image files saved to: {0}", Directory.GetCurrentDirectory()); foreach (Entity record in binaryImageResults.Entities) { String recordName = record["sample_name"] as String; String downloadedFileName = String.Format("Downloaded_{0}", recordName); byte[] imageBytes = record["entityimage"] as byte[]; var fs = new BinaryWriter(new FileStream(downloadedFileName, FileMode.Append, FileAccess.Write)); fs.Write(imageBytes); fs.Close(); Console.WriteLine(downloadedFileName); CodeCopyaccept the answer if its helpful for you0
Rajeesh MenothRank #118 · 18.4K reputation11y agoPosted Jan 4, 2016, 9:22 PM EST0Hi, Check the following reference : Video Tutorial : https://www.youtube.com/watch?v=-fkdrgFiaeI Other Reference : http://www.aspsnippets.com/Articles/Upload-and-Download-files-from-SQL-Server-Database-in-ASPNet.aspx http://www.aspdotnet-suresh.com/2013/01/aspnet-download-and-upload-files-to.html http://www.aspsnippets.com/Articles/Retrieve-and-display-PDF-Files-from-database-in-browser-in-ASPNet.aspx 0
Ankur MistryRank #86 · 23.9K reputation11y agoPosted Jan 4, 2016, 10:39 PM EST0Hi,Check : http://www.aspsnippets.com/Articles/Upload-and-Download-files-from-SQL-Server-Database-in-ASPNet.aspx 0
Paul RajsRank #2,423 · 582 reputation11y agoPosted Jan 6, 2016, 1:13 AM EST0Thanks a lot for all of your reply, i can able to accept only one answer, So i can't able accept all of your answers. Paul.S 0
Arul RRank #2,478 · 566 reputationPosted Jan 4, 2016, 9:20 PM EST
Sandy SurwaseRank #8,477 · 221 reputationPosted Jan 4, 2016, 9:20 PM EST
Rajeesh MenothRank #118 · 18.4K reputationPosted Jan 4, 2016, 9:22 PM EST
Ankur MistryRank #86 · 23.9K reputationPosted Jan 4, 2016, 10:39 PM EST
Paul RajsRank #2,423 · 582 reputationPosted Jan 6, 2016, 1:13 AM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts