def post(self):
        study_id = int(self.get_argument('study_id'))
        filepath = self.get_argument('filepath')
        data_type = self.get_argument('data_type')
        direct_upload = self.get_argument('direct_upload', False)

        if direct_upload and direct_upload == 'true':
            direct_upload = True

            with NamedTemporaryFile(suffix='.txt', delete=False) as fp:
                fp.write(self.request.files['theFile'][0]['body'])
                filepath = fp.name

        self.write(sample_template_handler_post_request(
            study_id, self.current_user, filepath, data_type=data_type,
            direct_upload=direct_upload))