ArcGIS REST API Generate VS Esri Request

10-07-2019 09:57 AM
New Contributor III


I am using esri request in a web application with VERSION  3.8 of the API ArcGIS Javascipt to add  a shapefile (

The application gives the following error:

This is the Network tab in Chrome:

This is my function:

generateFeatureCollection: function (fileName) {
  var name = fileName.split(".");
  name = name[0].replace("c:\\fakepath\\", "");
  var params = {
  'name': name,
  'targetSR': this.activeMainMap.spatialReference,
  'maxRecordCount': 1000,
  'enforceInputFileSizeLimit': true,
  'enforceOutputJsonSizeLimit': true
  var extent = scaleUtils.getExtentForScale(, 40000);
  var resolution = extent.getWidth() /;
  params.generalize = true;
  params.maxAllowableOffset = resolution;
  params.reducePrecision = true;
  params.numberOfDigitsAfterDecimal = 0;
  var myContent = {
   'filetype': 'shapefile',
   'publishParameters': JSON.stringify(params),
   'f': 'json',
   'callback.html': 'textarea'

  var portalUrl= '';
     url: portalUrl + '/sharing/rest/content/features/generate',
     content: myContent,
     form: dom.byId('uploadFormCargaRodales'),
     handleAs: 'json',
     load: lang.hitch(this, function (response) {
    if (response.error) {
       console.log("response.error: ", response.error)
   var layerName = response.featureCollection.layers[0];
 error: lang.hitch(this, this.errorHandler)

This is my html:


<form enctype="multipart/form-data" method="post" id="uploadFormCargaRodales">
          <input type="file" name="file" id="inFile" />



The error occurs in esriRequest.

I have read this but without results:

and  this:


I've tried also with esri.request (v 3.8) but without results too.

If you change 3.29 by 3.8 in this example happen my error (unexpected token <)

Any suggestions?

Thank you very much, greetings.

Tags (1)
0 Kudos
0 Replies