Hi, I am storing the uploaded file contents in db and also able to reterive the data succesfully. but when i try to reterive data for file type application/pdf, it is showing blank page. i am not able to get what must be the issue ....
i am posting the code which i am using to reterive the binary data from db and convert to readable format
Not that this is really a SQL Server question, but the code I use for file downloads is:
So, the major differences are, I'm using WriteFile rather than OutputStream.Write (this shouldn't make a difference though), I'm calling Flush() rather than End(), and I'm adding a header for the Content-Length.
You should verify however, that your 'data' variable is in fact a byte array, and that the length you are retrieving is not 0. I would personally not get the length from the database, but use
answered Feb 12, 2010 at 10:25 AM
Matt Whitfield ♦♦
hey thanks Matt, I needed to add "attachment" to reterive file , look the code i have posted below
I just simply love this forum, i get the issues solved :-)
answered Feb 15, 2010 at 07:15 AM
You may wany to consider using FileStream storage for this kind of application. FileStream works well for binary data larger than about 1-2MB.
answered Feb 12, 2010 at 10:31 AM
You need to make sure you send the correct MIME type for PDF which is...
There might be another issue with this script but setting the right Content Type will help your end users when the browser comes to decide what to do with the file.
Check out MIME Type Detection for more information.
answered Feb 12, 2010 at 02:58 PM