I have experienced inserting images to database. What I did is to create chunks of the image with sequence.

e.g:
Let's consider 10mb Image,
I will gave the memptr variable size of 2500kb, assign 2500kb part by part of file and save to database.

Sequence_(ImageChunk)_________Size
1________%$#@^^@^^%&(_________2500kb
2________%$&&^@((@((F_________
2500kb
3________((@#(#&^@#*!_________2500kb
...
..
. and so on

That way, you'll have an idea about the current size of the file being transfer.

Again, this is just an idea. I haven't tested this on web application and not sure if this will work on other file aside from images which i think may work.

good luck.