Uploading binary files to MySQL

wxdqz

New Member
Hi all,

I'm trying to set up a system to allow uploading binary files to a MySQL database--this is nothing new, so I've looked at the article here on PHP Builder and gotten code bits from other sites.

I'm messing around with the exact same example from PHP Builder, but the problem I'm having is that I've noticed that the "filetype" variable is empty when its inserted into the database. So obviously this is a problem when I try to retrieve the file because the browser has no idea how to display it. I've made sure all the variables are consistent throughout the code (I haven't changed anything with the exception of MySQL login stuff). Other variables such as filesize and filename work fine and stored in the DB correctly. Any ideas on why filetype isn't showing up?

In the download script I've also tried using "Header( "Content-type: image/jpeg");" instead of "Header( "Content-type: $filetype");" and then uploading a jpeg file to no avail--I get a broken image icon.

magic_quotes_gpc and magic_quotes_runtime are both off and I've tried messing around with addslashes() and stripslashes(), but nothing seems to work. I'm completely stumped. Any suggestions?? Thanks!
 
Back
Top