# File Upload Component Crashes Gateway

**URL:** <https://forum.inductiveautomation.com/t/file-upload-component-crashes-gateway/77720>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [August 10, 2023, 8:37pm UTC](https://forum.inductiveautomation.com/t/file-upload-component-crashes-gateway/77720 "2023-08-10T20:37:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacob.ramirez](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@jacob.ramirez](https://forum.inductiveautomation.com/u/jacob.ramirez)\
**Post date:** [August 10, 2023, 8:37pm UTC](https://forum.inductiveautomation.com/t/file-upload-component-crashes-gateway/77720/1 "2023-08-10T20:37:35Z")

</div>

Has anyone used the file upload component in perspective and caused the gateway to crash?

I'm testing that out and after I select the image, the gateway then crashes. Any ideas as to why its crashing everytime?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 10, 2023, 8:40pm UTC](https://forum.inductiveautomation.com/t/file-upload-component-crashes-gateway/77720/2 "2023-08-10T20:40:14Z")

</div>

What shows up in your wrapper log (the text file--not the logs in the web interface) ?

---

<div class="post-metadata">

**Author:** ![jacob.ramirez](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@jacob.ramirez](https://forum.inductiveautomation.com/u/jacob.ramirez)\
**Post date:** [August 11, 2023, 7:36pm UTC](https://forum.inductiveautomation.com/t/file-upload-component-crashes-gateway/77720/3 "2023-08-11T19:36:25Z")

</div>

I haven't been able to recreate this. However, now my perspective session is crashing when uploading a third file.

I am trying to build a screen where a user enters data and uploads pictures. Now I'm trying to insert them into the database (MySQL blob) which is working fine and pulling the images back out into a report is fine.

That said, on the screen I want the data and files (pictures) to be entered and when they hit submit, it sends all the data and pictures to the database. I move the file uploaded to a custom property called pictures which holds the data from the `event.file.getBytes()` function.

After uploading the 3rd image, my perspective session crashed. This is consistently now crashing when the third image is uploaded.

I want to wait to upload just in case the user selects the wrong picture or wants to take a new one. And all at once on a button push to insert the data and get its ID column (auto incremented) and use that as a foreign key in my images database table.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 11, 2023, 7:39pm UTC](https://forum.inductiveautomation.com/t/file-upload-component-crashes-gateway/77720/4 "2023-08-11T19:39:23Z")

</div>

> [@jacob.ramirez](#):
>
> now my perspective session is crashing

You still haven't supplied anything from your wrapper log file. We are not mind-readers. 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![Felipe\_Cordova](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@Felipe\_Cordova](https://forum.inductiveautomation.com/u/Felipe_Cordova)\
**Post date:** [April 26, 2024, 10:13pm UTC](https://forum.inductiveautomation.com/t/file-upload-component-crashes-gateway/77720/5 "2024-04-26T22:13:20Z")

</div>

Hello,

I have the same problem when I want to upload files, for example '.pdf', larger than 2MB, the file upload component crashed gateway.

This is the code I have in the component:

```python
data_b64 = base64.b64encode(event.file.getBytes()).decode('utf-8')
name = event.file.name
extension = name.split('.')[-1] if '.' in name else 'unknown'
size = event.file.size

```

When I load the file the screen freeze

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [April 27, 2024, 1:43am UTC](https://forum.inductiveautomation.com/t/file-upload-component-crashes-gateway/77720/6 "2024-04-27T01:43:01Z")

</div>

Does your Gateway contain any logging which might explain what is happening?

> [@Felipe\_Cordova](#):
>
> This is the code I have in the component:

Is this code in the `onFileReceived` Event?

---

<div class="post-metadata">

**Author:** ![Felipe\_Cordova](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@Felipe\_Cordova](https://forum.inductiveautomation.com/u/Felipe_Cordova)\
**Post date:** [April 29, 2024, 1:36pm UTC](https://forum.inductiveautomation.com/t/file-upload-component-crashes-gateway/77720/7 "2024-04-29T13:36:53Z")

</div>

I don't get any errors, after uploading the file it freezes.

Yes, the code is inside that component.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [April 29, 2024, 2:32pm UTC](https://forum.inductiveautomation.com/t/file-upload-component-crashes-gateway/77720/8 "2024-04-29T14:32:44Z")

</div>

Uploading the file is actually crashing your _Gateway?_ If so, you should reach out to Support instead of these forums. If it's just the Perspective Session which is freezing, there could still be logging present on the Gateway which could provide insight.
