randomly getting "sendto failed: epipe (broken pipe): http:..." when uploading images

// edit:  Fixed it: The “maxPostSize” parameter serverwise was set to a too small value. When the images exceeded a specific size, the error occurred. Changed this parameter and now it works :slight_smile:

Dear Corona-community,

what I’d like to do: Upload two images in a single request to a server

what I’ve coded so far:

-- read the temp picture into base64 pathPic1 = system.pathForFile( "faverImg1.jpg", system.TemporaryDirectory ) pathPic2 = system.pathForFile( "faverImg2.jpg", system.TemporaryDirectory ) pic1handler = io.open( pathPic1, "rb" ); pic2handler = io.open( pathPic2, "rb" ); -- start uploading in case reading process was success if (pic1handler and pic1handler) then -- encode the temp pictures into b64 pic1encoded = mime.b64(pic1handler:read( "\*a" )) pic2encoded = mime.b64(pic2handler:read( "\*a" )) -- build request body requestBody = "operation=uploadPic&userID=" .. system.getPreference("app", "userID", "string") .. "&pic1=" .. pic1encoded .. "&pic2=" .. pic2encoded .. "&context=" .. faverContext.text:urlEncode() -- context has to be urlencoded requestBodyLength = #requestBody -- activate waiting screen composer.showOverlay( "uploading", {isModal = true, effect = "fade", time = 200, params = {statustext = "lade Faver hoch..."}} ) -- close files io.close(pic1handler) io.close(pic2handler) -- create body params local params = {} params.body = requestBody params.progress = "upload" -- finally: send faver to server network.request(remotePicController, "POST", uploadListener, params)

what I’m expecting and experiencing most of the time: Well, most of the time it works.

What the problem is: Sometimes the upload does not work, I get an event.isError stating

sendto failed: epipe (broken pipe)

Any ideas? :slight_smile:

Glad you solved this!

Rob

Glad you solved this!

Rob