It seems that the postgres driver V2.0 has a bug in handling BLOBS. I switched to the old version 1.1 and portrait uploading works fine now.