NanoHttpd / nanohttpd

Tiny, easily embeddable HTTP server in Java.
http://nanohttpd.org
BSD 3-Clause "New" or "Revised" License
6.92k stars 1.69k forks source link

NanoHTTPD session.parseBody(files); timeout #494

Open openmotion opened 6 years ago

openmotion commented 6 years ago

Hello i want to send a file from a smartphone "A" with ion to a smartphone "B" with nanoHttpd

in the smartphone B i try to get the byte of the JPEG image and write it to a file

If i use this function : session.parseBody(files); I have a timeout error => Read timed out

another solution is to get the byte like this but the image isn't readable

Integer contentLength = Integer.parseInt(session.getHeaders().get( "content-length" )); byte[] buf = new byte[contentLength]; Log.d(TAG,"RequestBody: " + new String(buf));

this is my code to send the file from the smartphone A : Ion.with(mContext) .load(...) .setMultipartParameter("id_file", id_file) .setMultipartFile("image", "image/jpeg", file_data)

openmotion commented 6 years ago

ok i changed the the timeout in the start server function server.start(10000000); but now i have this error ; BAD REQUEST: Content type is multipart/form-data but contains less than two boundary strings