file upload with post

Joe Orton joe at manyfish.co.uk
Fri Mar 13 17:38:30 EDT 2009


On Thu, Mar 12, 2009 at 04:18:26PM +0100, Karl Hiramoto wrote:
> Is there anyone out there that has some example code of how to do a file  
> upload with post.   I've used neon before to do some http GET, but not  
> post.

If you wish to simply use a file as the POST request body, given an open 
fd for the file, try:

  ne_request *req = ne_request_create(sess, "POST", path);

  ne_set_request_body_fd(req, fd, 0, <length-of-file>);

  ret = ne_request_dispatch(req);
  // check for errors from ret

  ne_request_destroy(req);

Regards, Joe




More information about the neon mailing list