# Return msg from ui\_template node

**URL:** <https://discourse.nodered.org/t/return-msg-from-ui-template-node/4651>\
**Category:** Dashboard\
**Created:** [7 November 2018 17:16 UTC](https://discourse.nodered.org/t/return-msg-from-ui-template-node/4651 "2018-11-07T17:16:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rerrico](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@rerrico](https://discourse.nodered.org/u/rerrico)\
**Post date:** [7 November 2018 17:16 UTC](https://discourse.nodered.org/t/return-msg-from-ui-template-node/4651/1 "2018-11-07T17:16:55Z")

</div>

Hi:

I have code in a ui\_template node and i want to return the file name, in this case **$("#file-name").text(this.files[0].name);** to a connected node. How would that be done in the below code:

```auto
<html>
<head>
<meta http-equiv="Content-Language" content="en-ca">
</head>
<form action="/upload" enctype="multipart/form-data" method="POST">
    <p>XML File Upload:</p>
    <br>
    <label for="getFile" class="btn">
        CHOOSE XML FILE
    </label>
    <input id="getFile" name="myFile" type="file" style="display:none;">
    <label id="file-name"></label>
    <br><br>
    <input type="submit" button class="btn" value="UPLOAD XML FILE"/>
</form>
<script type="text/javascript">
$("#getFile").change(function(){
    $("#file-name").text(this.files[0].name);
});
</script>
</html>

Thanks in advance.
```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [7 November 2018 17:21 UTC](https://discourse.nodered.org/t/return-msg-from-ui-template-node/4651/2 "2018-11-07T17:21:54Z")

</div>

Please read this post in sharing code on the forum and then edit your post to fix up the formatting. The XML is being treated as HTML and not displaying.

> [@How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506):
>
> To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly. The easiest way to do that is to click the 'Preformatted Text' button in the toolbar: [image] Then paste in your code or flow json. You should end up with three back-tick characters - ``` - on their own line before and after the code. On standard US English keyboards, this is on the same key as the ~ character. Using the backticks will ens…

---

<div class="post-metadata">

**Author:** ![rerrico](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@rerrico](https://discourse.nodered.org/u/rerrico)\
**Post date:** [7 November 2018 17:36 UTC](https://discourse.nodered.org/t/return-msg-from-ui-template-node/4651/3 "2018-11-07T17:36:49Z")

</div>

Thanks, I updated my previous post.

---

<div class="post-metadata">

**Author:** ![rerrico](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@rerrico](https://discourse.nodered.org/u/rerrico)\
**Post date:** [7 November 2018 22:14 UTC](https://discourse.nodered.org/t/return-msg-from-ui-template-node/4651/4 "2018-11-07T22:14:00Z")

</div>

Found it in another object: **msg.req.files.myFile[0].originalname;**
