Downloading file from BLOB in aspx
Downloading file from BLOB in aspx
Downloading file from BLOB in aspx
Downloading file from BLOB in aspx
Downloading file from BLOB in aspx
Downloading file from BLOB in aspx Downloading file from BLOB in aspx Downloading file from BLOB in aspx Downloading file from BLOB in aspx Downloading file from BLOB in aspx Downloading file from BLOB in aspx Downloading file from BLOB in aspx Downloading file from BLOB in aspx
Downloading file from BLOB in aspx Downloading file from BLOB in aspx
Downloading file from BLOB in aspx
Go Back  Xtreme Visual Basic Talk > > > Downloading file from BLOB in aspx


Reply
 
Thread Tools Display Modes
  #1  
Old 04-27-2009, 03:20 PM
7h0m's Avatar
7h0m 7h0m is offline
Regular
 
Join Date: Feb 2008
Posts: 64
Exclamation Downloading file from BLOB in aspx


Hi!

We have blob'ed excel files in our database that I would like to make available for download on an aspx page. The data type is IMAGE. What code should I use to start a download of the data triggered with a link?
__________________
Nasa predicts Pole Shift in 2012. Google it.
Reply With Quote
  #2  
Old 04-28-2009, 08:30 AM
7h0m's Avatar
7h0m 7h0m is offline
Regular
 
Join Date: Feb 2008
Posts: 64
Default

btw the database is mySQL 2005
__________________
Nasa predicts Pole Shift in 2012. Google it.
Reply With Quote
  #3  
Old 04-28-2009, 09:08 AM
Qua's Avatar
QuaDownloading file from BLOB in aspx Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

How to go about this depends on the size of your Excel files. An easy way to do it would be to get the blob data, and then write it to the HTTP Response stream. Here's a simplified example of how I created a download feature:
Code:
Dim toWrite As String = "This Is My Data"
Dim fileName As String = "YourExcelFileSir.Xml"

Response.Clear()
Response.AddHeader("Content-Disposition", "attachment; fileName)
Response.AddHeader("Content-Length", toWrite.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.Write(toWrite)
		
Response.End()
There are a few things to keep in mind:
  • Do you want to load the whole content of the BLOB into memory before writing it on to the stream, or do you want to load/write it piece for piece
  • Are the files being used so often, that you should cache them
The above code can easily be modified so you don't have to load the whole file into memory before writing them onto the stream afterwards.
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #4  
Old 04-30-2009, 03:02 AM
Joyce1 Joyce1 is offline
Newcomer
 
Join Date: Dec 2008
Posts: 2
Default

btw the database is mySQL 2005
Reply With Quote
  #5  
Old 04-30-2009, 04:28 AM
Qua's Avatar
QuaDownloading file from BLOB in aspx Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

Quote:
Originally Posted by Joyce1 View Post
btw the database is mySQL 2005
Yes, he mentioned that :P?
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #6  
Old 05-01-2009, 12:58 PM
7h0m's Avatar
7h0m 7h0m is offline
Regular
 
Join Date: Feb 2008
Posts: 64
Talking Follow up

Hi!

Just wanted to say I'm still alive... and that the 'content type' solution is a good idea. Also, what strange response from the new member? And what's that other site, some kind of bounty hunter IT group?

I'll be back on when I'm asked to do it... the database is still empty for the moment.
__________________
Nasa predicts Pole Shift in 2012. Google it.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Downloading file from BLOB in aspx
Downloading file from BLOB in aspx
Downloading file from BLOB in aspx Downloading file from BLOB in aspx
Downloading file from BLOB in aspx
Downloading file from BLOB in aspx
Downloading file from BLOB in aspx Downloading file from BLOB in aspx Downloading file from BLOB in aspx Downloading file from BLOB in aspx Downloading file from BLOB in aspx Downloading file from BLOB in aspx Downloading file from BLOB in aspx
Downloading file from BLOB in aspx
Downloading file from BLOB in aspx
 
Downloading file from BLOB in aspx
Downloading file from BLOB in aspx
 
-->