Thanks a lot Pankaj for the response. Is this present in 6.3sp1 ? I just cross checked the system setting again in my 63sp1, environment and didnt find it. I also went ahead and created one setting with the same name pyMaxDragDropAttachSizeMB but it doesnt seem to work.
Thank you all for the response and the pointers. From what I could infer, there is no OOTB way to achieve this in 63sp1.In 7.x, it can be done via the System setting "pyMaxDragDropAttachSizeMB" as pointed out by Pankaj Rawal. I have developed the below java snippet that would use pega api to decrypt the uploaded file and give the size by calculating the number of bytes in the byte array.
The prconfig environment vaiable setting is useful if we want to restrict it system wide and it gives a 403 response from server stating the file size is larger. A simple page-set-message after calculating the size using the below snippet works.