# Save temporary upload files byte stream in memory

**URL:** <https://forum.inductiveautomation.com/t/save-temporary-upload-files-byte-stream-in-memory/86648>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 1, 2024, 5:11am UTC](https://forum.inductiveautomation.com/t/save-temporary-upload-files-byte-stream-in-memory/86648 "2024-03-01T05:11:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![schenk](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@schenk](https://forum.inductiveautomation.com/u/schenk)\
**Post date:** [March 1, 2024, 11:50am UTC](https://forum.inductiveautomation.com/t/save-temporary-upload-files-byte-stream-in-memory/86648/2 "2024-03-01T11:50:49Z")

</div>

You should be able to handle this by using a temporary file.

Create a file with something like this on the File Upload component

```auto
fileBytes = event.file.getBytes()
extension = event.file.name.split('.')[-1] 
tempFilePath = system.file.getTempFile(extension)
system.file.writeFile(tempFilePath, fileBytes)

# Store the temporary file path in a custom property
self.view.custom.tempFilePath = tempFilePath

```

When you want to send the email, you can read the file back like this:

```auto
tempFilePath = self.view.custom.tempFilePath
fileBytes = system.file.readFileAsBytes(tempFilePath)
...

```

The uploaded files will be deleted when the gateway restarts

---

_[View the full topic](https://forum.inductiveautomation.com/t/save-temporary-upload-files-byte-stream-in-memory/86648)._
