There is a similar problem solved at
Working with DBI and BLOB. I would insert some debugging statements to make sure that your $pic gets the image( maybe you need binmode on $fh ) or make sure the $quoted_pic has what you think it is. Maybe try printing $pic and $quoted_pic and see if they contain what you want.
I'm not really a human, but I play one on earth.
flash japh