Making a DCF to upload to server

I am trying to do a Data Capture Form, letting user add data to few fields and then add one image from the library/cam. 

Using multipart form example (http://developer.coronalabs.com/code/how-upload-image-server-multipartform-data) workds OK for the textfields but not for the image. It transforms somehow and is unreadable on the server.

I also tried network.upload, which gives me “Invalid Parameter: URL argument was malformed URL”

and the url is like : 
https://(mydomain)/addlist/0/be154336d2e52ca97f449c9b34e2b34e

So my question is how do you capture user data and an image to upload to a service/server and consume it properly.

The use case for this is very common when/if you have form to signup and add an avatar for your project/game, no?!

Regards

BK

UPDATE:

The problem is a bit more multifaceted than originally expected.

I thought the DECODE was not done right BUT, it turned out to be that some versions of php have the bug addressed here:

https://bugs.php.net/bug.php?id=55504

to make this work for you, if you have this issue is basically adding the CHARSET parameter BEFORE the boundary parameter like this:

self.headers[“Content-Type”] = “multipart/form-data; charset=UTF-8; boundary=”…self.boundary

Just some heads up.

Berhan K.

UPDATE:

The problem is a bit more multifaceted than originally expected.

I thought the DECODE was not done right BUT, it turned out to be that some versions of php have the bug addressed here:

https://bugs.php.net/bug.php?id=55504

to make this work for you, if you have this issue is basically adding the CHARSET parameter BEFORE the boundary parameter like this:

self.headers[“Content-Type”] = “multipart/form-data; charset=UTF-8; boundary=”…self.boundary

Just some heads up.

Berhan K.