# Upload file with RecordEditForm

**URL:** <https://forum.inductiveautomation.com/t/upload-file-with-recordeditform/99298>\
**Category:** Module Development\
**Created:** [December 2, 2024, 10:50am UTC](https://forum.inductiveautomation.com/t/upload-file-with-recordeditform/99298 "2024-12-02T10:50:44Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 2, 2024, 5:09pm UTC](https://forum.inductiveautomation.com/t/upload-file-with-recordeditform/99298/8 "2024-12-02T17:09:57Z")

</div>

The SECS/GEM module does this with the following:  
0. The stuff you're already doing in the form meta.

1. Subclassing `RecordEditForm`
2. Setting up a private final field to hold the `FileUploadField`:  
`private FileUploadField uploadField;`
3. Overriding `newEditorComponent` to capture the value in the field:

```java
    @Override
    protected Component newEditorComponent(String id, FormMeta formMeta, RecordEditMode mode, SRecordInstance record) {
        Component comp = super.newEditorComponent(id, formMeta, mode, record);
        if (formMeta.getField().equals(EquipmentRecord.SecsDefinitionFile)) {
            uploadField = (FileUploadField) ((AbstractFormComponentEditor<?>) comp).getFormComponent();
        }

```

1. Overriding `onSubmit` and extracting the list of uploaded files:

```java
List<FileUpload> fuList = uploadField.getModelObject();

```

The same general approach should work, though I'll echo Phil's general sentiment that the less engineering effort spent on wrangling Wicket the better.

---

_[View the full topic](https://forum.inductiveautomation.com/t/upload-file-with-recordeditform/99298)._
