I'm trying to develop a widget to allow the upload of a DWG file, which will be the input of a Geoprocessing service. I have the Geoprocessing Service published with the 'upload' capability enabled and set to Asynchronous, and "Maximum Number of Records Returned by Server:" set to like 100,000
I am using Experience Builder developer edition 1.9, with ArcGIS Enterprise 10.9. I should also note it is written in Type Script.
Currently I am struggling to get the upload/upload portion of the Geoprocessing service to work. I've posted my code below. I am uing the jimu TextInput component, set to type="file", and I am trying to trigger the upload/upload function on the onChange trigger

I've tried using esriRequest as reading the following documentation, it seems to be what I need to upload a file. And I am passing the file object into the esriRequest as the "Body" which is what it states in the documentation.
https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html
import React from "react";
import {Label,TextInput} from "jimu-ui";
import { esriRequest } from "esri/request";
const AddFileTab = () => {
const onFileInputChangeHandler = async function execute(evt😞 Promise<void> {
const file_input = evt.target.value
const url = "xyz/GPServer/uploads/upload"
esriRequest(url, {
body: file_input,
method : "post",
responseType : "json"
}).then((response) => {
console.log(response);
})
}
const renderer = () => {
return (
<div className={""}>
<Label >
Select file
</Label>
<TextInput
onAcceptValue={function noRefCheck(){}}
type="file"
onChange = {onFileInputChangeHandler}
/>
</div>
)
}
return renderer();
}
However, I get the following error
widget.tsx?cacc:16 Uncaught (in promise) TypeError: (0 , esri_request__WEBPACK_IMPORTED_MODULE_2__.esriRequest) is not a function
at Object.eval (widget.tsx?cacc:16:1)
at Generator.next (<anonymous>)
at eval (widget.tsx:14:71)
at new Promise (<anonymous>)
at __awaiter (widget.tsx:10:12)
at Object.execute [as onChange] (widget.tsx?cacc:11:1)
at index.js:3033:364
at Generator.next (<anonymous>)
at index.js:3010:1749
at new Promise (<anonymous>)
Can any suggest any solutions? Or would anyone be willing to share if they've managed to solve this functionality before? I have scoured the web but I can't find any other solutions specifically in Experience Builder and using TypeScript.
Any help would be greatly appreciated!