laptop and a wrench

Bug

FeatureLayer.addAttachment() is returning the HTML response with a feature service hosted on an enterprise environment.

Last Published: January 22, 2019 ArcGIS API for JavaScript
Bug ID Number BUG-000118713
SubmittedDecember 10, 2018
Last ModifiedJune 5, 2024
Applies toArcGIS API for JavaScript
Version found4.9
Operating SystemWindows OS
Operating System Version10.0 64 Bit
StatusNon-Reproducible

Additional Information

When using a multi-part post to send the file data, all parameters of the request have to be passed in the body of the request in the correct form. This includes the format (f) parameter which is not to be included in the querystring.

Workaround

Add the following bolded line of code to the HTML form:

<form id="importFileForm">

   Upload a file: <input type="file" name="attachment" id="fileinput">

   <input type="hidden" name="f" value="json">

 </form>

Or if using FormData class use the following code:

let form = new FormData();

form.set("attachment",file);

form.append("f","json");

Steps to Reproduce

Bug ID: BUG-000118713

Software:

  • ArcGIS API for JavaScript

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options