<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Experience Builder Custom Widget - Upload File in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-custom-widget-upload-file/m-p/1239940#M5886</link>
    <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error suggests that its not importing esriRequest correctly. Looking at what you have in your import statement, you are trying to import a non-default export by using the {}, esriRequest, is the default export, can you try changing the import statement to&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import esriRequest from 'esri/request'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;instead of&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import {esriRequest} from 'esri/request'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is a utils file we have that we use for the GP services that require upload functionality.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import { getAppStore } from "jimu-core";
import esriRequest from "esri/request";
import Geoprocessor from 'esri/tasks/Geoprocessor';

export default class GeoprocessingUtils {
    uploadUrl: string;
    token: string;
    gp: Geoprocessor;

    constructor(url: string, isUploadSupported: boolean = false) {
        this.token = getAppStore().getState().token;
        const serverUrl = getAppStore().getState().portalUrl.replace("portal", "server");
        const gpUrl = serverUrl + url + "?token=" + this.token;

        this.gp = new Geoprocessor({ url: gpUrl });
        if (isUploadSupported) {
            const urlArr = url.split("/GPServer/");
            this.uploadUrl = (urlArr.length &amp;gt; 1) ? serverUrl + urlArr[0] + "/GPServer/uploads/upload" : "";
        } else {
            this.uploadUrl = "";
        }
    }

    uploadFile = async (file: any): Promise&amp;lt;string&amp;gt; =&amp;gt; {
        let form = new FormData();
        form.append('file', file);
        form.append("f", "json");
        form.append("title", file.name);
        form.append("name", file.name);
        form.append("type", file.type);
        form.append("token", this.token);
        form.append("filename", file.name);

        let upload = await esriRequest(this.uploadUrl, {
            method: "post", body: form
        }).then(this.uploadSucceeded, this.uploadFailed)
            .catch((error) =&amp;gt; {
                console.error('An error occured uploading the file: ' + error);
                return null;
            });

        if (upload) {
            return upload;
        } else {
            return null;
        }

    }

    executeTaskAsyn = async (params: any): Promise&amp;lt;any&amp;gt; =&amp;gt; {
        let response = await this.gp.submitJob(params)
            .then(async (jobInfo) =&amp;gt; {
                console.log(jobInfo);
                var jobid = jobInfo.jobId;
                var options = {
                    interval: 1500,
                    statusCallback: function (j) {
                        console.log("Job Status: ", j.jobStatus);
                    }
                };
                return this.gp.waitForJobCompletion(jobid, options).then(async () =&amp;gt; {
                    return this.gp.getResultData(jobid, "result").then((result) =&amp;gt; {
                        return result.value;
                    }).catch(error =&amp;gt; {
                        console.error(error);
                        return { "error": "Failed to run geoprocessing task" };
                    });
                   
                });
                
            })
            .catch((error) =&amp;gt; {
                console.error(error)
                let errorMessages = error.messages.filter(msg =&amp;gt; msg.type === 'error');
                //the first error is the error message from gp output parameter
                if (errorMessages.length &amp;gt; 0) {
                    return { "error": errorMessages[0].description }
                } else {
                    return { "error": "Failed to run geoprocessing task" };
                }
            });

        if (response) {
            return response;
        }
    }

    uploadSucceeded = (response) =&amp;gt; {
        var itemID = response["data"]["item"].itemID;
        console.log("File upload successful, item ID: ", itemID);
        return itemID;
    }

    uploadFailed = (response) =&amp;gt; {
        console.log("Failed: ", response);
        return null;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
    <pubDate>Sat, 10 Dec 2022 18:42:38 GMT</pubDate>
    <dc:creator>Grant-S-Carroll</dc:creator>
    <dc:date>2022-12-10T18:42:38Z</dc:date>
    <item>
      <title>Experience Builder Custom Widget - Upload File</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-custom-widget-upload-file/m-p/1239916#M5885</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I'm trying to develop a widget to allow the upload of a DWG file, which will be the input of a Geoprocessing service.&amp;nbsp;I have the Geoprocessing Service published with the 'upload' capability enabled and set to&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Asynchronous, and "Maximum Number of Records Returned by Server:" set to like 100,000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I am using Experience Builder developer edition 1.9, with ArcGIS Enterprise 10.9. I should also note it is written in Type Script.&lt;/P&gt;&lt;P&gt;Currently I am struggling to get the upload/upload portion of the Geoprocessing service to work. I've posted my code below.&amp;nbsp;&lt;SPAN&gt;I am uing the jimu TextInput component, set to&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;type&lt;/SPAN&gt;&lt;SPAN&gt;="file", and I am trying to trigger the upload/upload function on the onChange trigger&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielCaparrosMidwood2_0-1670679422949.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/58199i923C06BA65D35325/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanielCaparrosMidwood2_0-1670679422949.png" alt="DanielCaparrosMidwood2_0-1670679422949.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html&lt;/A&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;React&lt;/SPAN&gt; &lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"react"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;SPAN&gt;Label&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;TextInput&lt;/SPAN&gt;&lt;SPAN&gt;} &lt;/SPAN&gt;&lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"jimu-ui"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; { &lt;/SPAN&gt;&lt;SPAN&gt;esriRequest&lt;/SPAN&gt;&lt;SPAN&gt; } &lt;/SPAN&gt;&lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;"esri/request"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;AddFileTab&lt;/SPAN&gt;&lt;SPAN&gt; = () &lt;/SPAN&gt;&lt;SPAN&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;onFileInputChangeHandler&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;async&lt;/SPAN&gt; &lt;SPAN&gt;function&lt;/SPAN&gt; &lt;SPAN&gt;execute&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;evt&lt;/SPAN&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; &lt;/SPAN&gt;&lt;SPAN&gt;Promise&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;void&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;file_input&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;evt&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;target&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;value&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;url&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"XXXX/GPServer/uploads/upload"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;esriRequest&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;url&lt;/SPAN&gt;&lt;SPAN&gt;, {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;body&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;file_input&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;method&lt;/SPAN&gt;&lt;SPAN&gt; :&lt;/SPAN&gt; &lt;SPAN&gt;"post"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;responseType&lt;/SPAN&gt;&lt;SPAN&gt; :&lt;/SPAN&gt; &lt;SPAN&gt;"json"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }).&lt;/SPAN&gt;&lt;SPAN&gt;then&lt;/SPAN&gt;&lt;SPAN&gt;((&lt;/SPAN&gt;&lt;SPAN&gt;response&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;console&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;response&lt;/SPAN&gt;&lt;SPAN&gt;);&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;renderer&lt;/SPAN&gt;&lt;SPAN&gt; = () &lt;/SPAN&gt;&lt;SPAN&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;div&lt;/SPAN&gt; &lt;SPAN&gt;className&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;SPAN&gt;""&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;Label&lt;/SPAN&gt; &lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select file&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;Label&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;TextInput&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;onAcceptValue&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;{function&lt;/SPAN&gt; &lt;SPAN&gt;noRefCheck&lt;/SPAN&gt;&lt;SPAN&gt;(){}&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;type&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"file"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;onChange&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;SPAN&gt;onFileInputChangeHandler&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;div&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;renderer&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;However, I get the following error&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;widget.tsx?cacc:16 Uncaught (in promise) TypeError: (0 , esri_request__WEBPACK_IMPORTED_MODULE_2__.esriRequest) is not a function&lt;BR /&gt;at Object.eval (widget.tsx?cacc:16:1)&lt;BR /&gt;at Generator.next (&amp;lt;anonymous&amp;gt;)&lt;BR /&gt;at eval (widget.tsx:14:71)&lt;BR /&gt;at new Promise (&amp;lt;anonymous&amp;gt;)&lt;BR /&gt;at __awaiter (widget.tsx:10:12)&lt;BR /&gt;at Object.execute [as onChange] (widget.tsx?cacc:11:1)&lt;BR /&gt;at index.js:3033:364&lt;BR /&gt;at Generator.next (&amp;lt;anonymous&amp;gt;)&lt;BR /&gt;at index.js:3010:1749&lt;BR /&gt;at new Promise (&amp;lt;anonymous&amp;gt;)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 15:21:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-custom-widget-upload-file/m-p/1239916#M5885</guid>
      <dc:creator>Colome</dc:creator>
      <dc:date>2022-12-10T15:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Experience Builder Custom Widget - Upload File</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-custom-widget-upload-file/m-p/1239940#M5886</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error suggests that its not importing esriRequest correctly. Looking at what you have in your import statement, you are trying to import a non-default export by using the {}, esriRequest, is the default export, can you try changing the import statement to&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import esriRequest from 'esri/request'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;instead of&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import {esriRequest} from 'esri/request'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is a utils file we have that we use for the GP services that require upload functionality.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import { getAppStore } from "jimu-core";
import esriRequest from "esri/request";
import Geoprocessor from 'esri/tasks/Geoprocessor';

export default class GeoprocessingUtils {
    uploadUrl: string;
    token: string;
    gp: Geoprocessor;

    constructor(url: string, isUploadSupported: boolean = false) {
        this.token = getAppStore().getState().token;
        const serverUrl = getAppStore().getState().portalUrl.replace("portal", "server");
        const gpUrl = serverUrl + url + "?token=" + this.token;

        this.gp = new Geoprocessor({ url: gpUrl });
        if (isUploadSupported) {
            const urlArr = url.split("/GPServer/");
            this.uploadUrl = (urlArr.length &amp;gt; 1) ? serverUrl + urlArr[0] + "/GPServer/uploads/upload" : "";
        } else {
            this.uploadUrl = "";
        }
    }

    uploadFile = async (file: any): Promise&amp;lt;string&amp;gt; =&amp;gt; {
        let form = new FormData();
        form.append('file', file);
        form.append("f", "json");
        form.append("title", file.name);
        form.append("name", file.name);
        form.append("type", file.type);
        form.append("token", this.token);
        form.append("filename", file.name);

        let upload = await esriRequest(this.uploadUrl, {
            method: "post", body: form
        }).then(this.uploadSucceeded, this.uploadFailed)
            .catch((error) =&amp;gt; {
                console.error('An error occured uploading the file: ' + error);
                return null;
            });

        if (upload) {
            return upload;
        } else {
            return null;
        }

    }

    executeTaskAsyn = async (params: any): Promise&amp;lt;any&amp;gt; =&amp;gt; {
        let response = await this.gp.submitJob(params)
            .then(async (jobInfo) =&amp;gt; {
                console.log(jobInfo);
                var jobid = jobInfo.jobId;
                var options = {
                    interval: 1500,
                    statusCallback: function (j) {
                        console.log("Job Status: ", j.jobStatus);
                    }
                };
                return this.gp.waitForJobCompletion(jobid, options).then(async () =&amp;gt; {
                    return this.gp.getResultData(jobid, "result").then((result) =&amp;gt; {
                        return result.value;
                    }).catch(error =&amp;gt; {
                        console.error(error);
                        return { "error": "Failed to run geoprocessing task" };
                    });
                   
                });
                
            })
            .catch((error) =&amp;gt; {
                console.error(error)
                let errorMessages = error.messages.filter(msg =&amp;gt; msg.type === 'error');
                //the first error is the error message from gp output parameter
                if (errorMessages.length &amp;gt; 0) {
                    return { "error": errorMessages[0].description }
                } else {
                    return { "error": "Failed to run geoprocessing task" };
                }
            });

        if (response) {
            return response;
        }
    }

    uploadSucceeded = (response) =&amp;gt; {
        var itemID = response["data"]["item"].itemID;
        console.log("File upload successful, item ID: ", itemID);
        return itemID;
    }

    uploadFailed = (response) =&amp;gt; {
        console.log("Failed: ", response);
        return null;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 18:42:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-custom-widget-upload-file/m-p/1239940#M5886</guid>
      <dc:creator>Grant-S-Carroll</dc:creator>
      <dc:date>2022-12-10T18:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Experience Builder Custom Widget - Upload File</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-custom-widget-upload-file/m-p/1241905#M5919</link>
      <description>&lt;P&gt;Excellent - thank you. Changing the " import esriRequest" worked. And the way you format the Params was what I need.&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 09:41:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-custom-widget-upload-file/m-p/1241905#M5919</guid>
      <dc:creator>Colome</dc:creator>
      <dc:date>2022-12-16T09:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Experience Builder Custom Widget - Upload File</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-custom-widget-upload-file/m-p/1274336#M6607</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/524867"&gt;@Colome&lt;/a&gt;&amp;nbsp;would you be willing to share your updated code to show how you got it working. I'm running into a similar issue and am struggling to get the upload to work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2023 00:02:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-custom-widget-upload-file/m-p/1274336#M6607</guid>
      <dc:creator>MarkEastwood</dc:creator>
      <dc:date>2023-04-01T00:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Experience Builder Custom Widget - Upload File</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-custom-widget-upload-file/m-p/1496289#M13258</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/404038"&gt;@Grant-S-Carroll&lt;/a&gt;&amp;nbsp;&amp;nbsp;Can you please help me on how to create the custom widget for Experience Builder - Upload the CAD .dwg file&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jun 2024 09:49:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-custom-widget-upload-file/m-p/1496289#M13258</guid>
      <dc:creator>abhassan</dc:creator>
      <dc:date>2024-06-23T09:49:07Z</dc:date>
    </item>
  </channel>
</rss>

