Return json encoded content on file upload when html flag is true