For those who cannot upload more than 4 mb even though size of field defined in database for image_data is 8 mb or more:
On database server there is Metabase.xml file. Do
search on google for this file if you cannot find it.
Look for following attributes:
AspMaxRequestEntityAllowed
AspBufferingLimit
This allows to upload file upto 8 mb:
AspMaxRequestEntityAllowed = change its value to 8388608(8 mb)
This allows displaying file upto 8 mb.
AspBufferingLimit = change its value to 8388608(8 mb).
Make sure you keep copy of metabase.xml before you make any changes. And after making changes and saving it make sure you open same file and see if your changes are in there. Sometimes it does not save. Not sure why..
Also one more important point to note. Wherever you have Response.Buffer = true in your code - just below add another line that will be "Server.ScriptTimeout = 240" <---- (240 seconds = 4 minutes). This depends on how much time your script will take to upload or display file. Hope this will be helpful.. Good luck!