Snaptea Posted May 23, 2012 Share Posted May 23, 2012 Hey everyone, I am trying to use BLOBs to upload files to our site. (In the past I always thought it was easier to just upload the file directly to the server and link to it via the database, but we have a security expert that has told us it is more secure to do it via BLOBs). We will also be using a free tool that scans each file for Malware but we aren't there yet... I am able to upload the files into the MySQL Database but I cannot output the data. I do not need to display the information on the screen, all I need is a link so that the user can download the information. The problem is that the output is a bunch of encrypted information is seems like. I have attached the screenshot below as an example of a .gif. The first few lines are the ID, File Size, File Type, File Name, and finally the long string of Final Content. If anyone can help me figure this out it would be great. Quote Link to comment https://forums.phpfreaks.com/topic/262963-php-mysql-downloading-blobs/ Share on other sites More sharing options...
rythemton Posted May 23, 2012 Share Posted May 23, 2012 The data is showing properly in the database. A BLOB is a Binary Object, so it will not be human readable. All you have to do to display it is set the header to the proper type, and echo the contents of the retrieved field. Don't output anything else, just the contents of that field. Here is an example that stores and outputs a BLOB stored in MySQL: http://www.anyexample.com/programming/php/php_mysql_example__image_gallery_(blob_storage).xml Quote Link to comment https://forums.phpfreaks.com/topic/262963-php-mysql-downloading-blobs/#findComment-1347856 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.