Greetings,
I have a JSAPI app that I have built that uses a geoprocessing tool to pass information back to our ArcGIS server. The geoprocessing tool is used to post information to another vendors API. I have everything working very well except for passing an image from my app.
One of the parameters I would like to pass back is an image captured from a iPad camera. I am using the following to capture the image:
<input id="accountPhoto" name="attachment" type="file" accept="image/*" capture="camera" data-clear-btn="true">
I have tried different variations of passing it back into the geoprocessing parameters, but I have had no luck. What would be the proper way to pass a captured image as a geoprocessing parameter?
Regards,
Tom
Solved! Go to Solution.
Is your GP service configured to allow uploads?
If you are using API 3.x then you can upload files with a standard request:
esri.request({ url: "http://<server>/arcgis/rest/services/GP_Services/<gservice>/GPServer/uploads/upload", form: dojo.byId("uploadForm"), // dom element content: { f: "pjson" }, handleAs: "json", load: uploadSuccess, // callback error: uploadFailed // on error });
HTML upload form:
<form enctype="multipart/form-data" method="post" id="uploadForm"> <div class="field"> <label class="file-upload"> <span><strong>Add File</strong></span> <input type="file" name="file" id="inFile" /> </label> </div> </form>
Is your GP service configured to allow uploads?
If you are using API 3.x then you can upload files with a standard request:
esri.request({ url: "http://<server>/arcgis/rest/services/GP_Services/<gservice>/GPServer/uploads/upload", form: dojo.byId("uploadForm"), // dom element content: { f: "pjson" }, handleAs: "json", load: uploadSuccess, // callback error: uploadFailed // on error });
HTML upload form:
<form enctype="multipart/form-data" method="post" id="uploadForm"> <div class="field"> <label class="file-upload"> <span><strong>Add File</strong></span> <input type="file" name="file" id="inFile" /> </label> </div> </form>
FC,
Thanks very much for your reply. It was exactly what I was looking for. I did not have uploads turned on either. I got them turned on and reworked the workflow to post the uploaded photo to our vendors API.
Regards,
Tom