AnsweredAssumed Answered

Sending a reduced size image to file upload

Question asked by tsellste Champion on Nov 15, 2016
Latest reply on Nov 15, 2016 by tsellste



I have a mobile app that I have built using the JSAPI that allows the user to take a picture with their iPad and posts it to a geoprocessing upload service.  This is working very well, but the image size is unnecessarily large.  I have a couple of functions that reduce the image size and create a BLOB that I would like to post to the same geoprocessing upload service.  I have tried many different variations of posting the file using the request module in the JSAPI with no luck.


The request I make gives me a request succeeded message, but I can see in my ArcGIS Server logs that the request is actually failing (which is also odd...).  The error message says "Error performing upload operation, File size or type not supported for this service".  I am using the FormData which the documentation says will work, but I am obviously missing something.  Here is a snippet of the code that I am using to post the reduced size image.


var data = new FormData();
data.append('file', imageResized);
var photoRequest = esriRequest({
   url: url,
   form: data,
   content: { f: "json" },
   handleAs: "blob",
   load: requestSucceeded, // callback
   error: requestFailed // on error


I would appreciate any suggestions on what I am missing. 


Thanks very much!