Updated upload_init_template function