Return json string when error occurs during file upload