/temp directory was not existing there inside of /internal_data directory. I created it and set the permissions 777 on it. The issue got resolved for uploads but now the same error exception is being logged when trying to access media i.e; on Media Index page, New Media page etc.
I'm using [bd]DataStorage, [bd]AttachmentStorage and Xen Media Gallery on my forum. Also, I'm using s3 storage on my server.
Here is a screenshot for new instance of the error exception