May you make a timeout for transaction which is smaller than the time needed to send the binary data for the image and saving it in database I recommend you to open another thread in MySQL forum
http://www.daniweb.com/forums/forum126.html you may find someone helps you...