if you cfdump out the form scope, the file field should be a server path on your Mac, not an android path
the client is an android device, trying to post a photo, that’s why it’s the internal storage path on Android device
Actually I do have the content of the upload file and I can write it like this
<cfset cnt= getHttpRequestData()['content']</cfset>
<cffile action="write" file="#path#/imagecnt.jpg" output="#cnt#">
However the written file doesn’t appear to be a valid jpg…
file -I imagecnt.jpg
application/octet-stream; charset=binary
Exactly like the mime type is not even understood.
The relevant Android code of the client seems to set it correctly
conn = (HttpURLConnection) url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("ENCTYPE", "multipart/form-data");
conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
conn.setRequestProperty("uploadimage", fileName);
dos = new DataOutputStream(conn.getOutputStream());
dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=\"uploadimage\";filename=\"" + fileName + "\"" + lineEnd);
dos.writeBytes(lineEnd);
I upgraded to last version 5.3.3.62 as suggested by @Zackster and now it works fine!
I think it was the regression issue [LDEV-2180] - Lucee
Thank you both @Zackster and @cfmitrah for your time, I wasn’t expecting such a quick response.
1 Like