Problem.
I'm a developer working on Apollo (which has some rudimentary ODK support). I'm trying to add support for images, but instead of the attached file coming with the name of the field defined for it (image
), it's coming in with the name of the file.
If anyone here is familiar with Flask, instead of the image coming in request.files['image']
, the actual key isn't image
but the name of the file. I could look at all attachments, but that is a problem because if I have multiple attachments, I wouldn't know what file to match to what field.
It's likely to be something I'm doing wrong, but I'm not sure how to fix it.
2. What app or server are you using and on what device and operating system? Include version numbers.
ODK Collect 1.27.3 on Android Go 8.1.0
3. What you have you tried to fix the problem?
As I mentioned above, I could simply check all uploaded files except for xml_submission_file
- in this case, since I'm only expecting a single image, but it's an issue if I was expecting multiple files, each as a response to a specific question.
4. What steps can we take to reproduce the problem?
5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
Here's my form XML:
<?xml version="1.0" encoding="UTF-8"?>
<h:html xmlns:h="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/2002/xforms" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>Incident</h:title>
<model>
<instance>
<data id="eb80d63b353540beb7cb0e5495fa4d11" orx:version="20200828085438971904">
<form_id>4</form_id>
<device_id />
<subscriber_id />
<phone_number />
<location />
<image />
</data>
</instance>
<bind nodeset="/data/form_id" readonly="true()" />
<bind nodeset="/data/version_id" readonly="true()" />
<bind nodeset="/data/device_id" jr:preload="property" jr:preloadParams="deviceid" />
<bind nodeset="/data/subscriber_id" jr:preload="property" jr:preloadParams="subscriberid" />
<bind nodeset="/data/phone_number" jr:preload="property" jr:preloadParams="phonenumber" />
<bind nodeset="/data/location" type="geopoint" />
<bind nodeset="/data/image" type="image" />
</model>
</h:head>
<h:body>
<group>
<label>Location</label>
<input ref="location">
<label>Location</label>
</input>
</group>
<group>
<label>Image</label>
<upload mediatype="image/*" ref="image">
<label>Image</label>
</upload>
</group>
</h:body>
</h:html>
Here's the server log, including the print out of request.files
: