<?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 Upload Shapefile error: cannot read property of name in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/upload-shapefile-error-cannot-read-property-of/m-p/1071523#M14534</link>
    <description>&lt;P&gt;js 3.36&lt;/P&gt;&lt;P&gt;Attempting to implement the &lt;A href="https://developers.arcgis.com/javascript/3/jssamples/portal_addshapefile.html" target="_self"&gt;upload shapefile example&lt;/A&gt; into a new custom widget but having an issue on the first attempt (subsequent attempts using a different .zip name works as expected).&amp;nbsp; Basically on the request({load:}) property it errors with "TypeError: Cannot read property of name of undefined at &lt;A href="https://js.arcigs.com..." target="_blank"&gt;https://js.arcigs.com...&lt;/A&gt;. and just goes to the errorHandler.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//use the rest generate operation to generate a feature collection from the zipped shapefile.  
			     request({
			         url: this.portalUrl + '/sharing/rest/content/features/generate',
			         content: myContent,
			         form: dom.byId('uploadForm'),
			         handleAs: 'json',
			         load: lang.hitch(this, function (response) {
			             if (response.error) {
			                 console.log("response.error: ", response.error);
			                 this.errorHandler(response.error);
			                 return;
			             }
			             var layerName = response.featureCollection.layers[0].layerDefinition.name;
			             dom.byId('upload-status').innerHTML = '&amp;lt;b&amp;gt;Loaded: &amp;lt;/b&amp;gt;' + layerName;
			             this.addShapefileToScratch(response.featureCollection);
                         document.getElementById("inFile").innerHTML = '';
			         }),
			         error: lang.hitch(this, this.errorHandler)
			     }, { usePost: 'true' });
			 },

			 errorHandler: function (error) {
			     dom.byId('upload-status').innerHTML = "&amp;lt;p style='color:red'&amp;gt;" + error.message + "&amp;lt;/p&amp;gt;";
			     console.log("errorHandler: ", error.message)
			     document.getElementById("inFile").innerHTML = '';
			 },&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Jun 2021 15:31:04 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2021-06-23T15:31:04Z</dc:date>
    <item>
      <title>Upload Shapefile error: cannot read property of name</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/upload-shapefile-error-cannot-read-property-of/m-p/1071523#M14534</link>
      <description>&lt;P&gt;js 3.36&lt;/P&gt;&lt;P&gt;Attempting to implement the &lt;A href="https://developers.arcgis.com/javascript/3/jssamples/portal_addshapefile.html" target="_self"&gt;upload shapefile example&lt;/A&gt; into a new custom widget but having an issue on the first attempt (subsequent attempts using a different .zip name works as expected).&amp;nbsp; Basically on the request({load:}) property it errors with "TypeError: Cannot read property of name of undefined at &lt;A href="https://js.arcigs.com..." target="_blank"&gt;https://js.arcigs.com...&lt;/A&gt;. and just goes to the errorHandler.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//use the rest generate operation to generate a feature collection from the zipped shapefile.  
			     request({
			         url: this.portalUrl + '/sharing/rest/content/features/generate',
			         content: myContent,
			         form: dom.byId('uploadForm'),
			         handleAs: 'json',
			         load: lang.hitch(this, function (response) {
			             if (response.error) {
			                 console.log("response.error: ", response.error);
			                 this.errorHandler(response.error);
			                 return;
			             }
			             var layerName = response.featureCollection.layers[0].layerDefinition.name;
			             dom.byId('upload-status').innerHTML = '&amp;lt;b&amp;gt;Loaded: &amp;lt;/b&amp;gt;' + layerName;
			             this.addShapefileToScratch(response.featureCollection);
                         document.getElementById("inFile").innerHTML = '';
			         }),
			         error: lang.hitch(this, this.errorHandler)
			     }, { usePost: 'true' });
			 },

			 errorHandler: function (error) {
			     dom.byId('upload-status').innerHTML = "&amp;lt;p style='color:red'&amp;gt;" + error.message + "&amp;lt;/p&amp;gt;";
			     console.log("errorHandler: ", error.message)
			     document.getElementById("inFile").innerHTML = '';
			 },&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 15:31:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/upload-shapefile-error-cannot-read-property-of/m-p/1071523#M14534</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-06-23T15:31:04Z</dc:date>
    </item>
  </channel>
</rss>

