Page 1 of 1

Multipart form post

Posted: Sat Dec 29, 2012 10:11 am
by BruceN
Hello,

My name is Andrew and I'm working with Bruce on a project to integrate with some other software over HTTP. We've been able to use the LoadURL to post data to the web service, but we also want to post multipart form data so that files can be uploaded to the web server. I couldn't find any examples of how to post a file using the LoadURL function; could anybody provide a couple lines of example code on how to read afile and then post the data using the LoadURL function? Or at least guidance on where to look?

Thanks in advance,
Andrew

Re: Multipart form post

Posted: Sat Dec 29, 2012 10:46 am
by BruceN
Another question for same project: is there a SIMPLE html editor that we can use in or in or instead of a dc_memoedit?

tnx,

bruce

Re: Multipart form post

Posted: Sat Dec 29, 2012 11:16 am
by rdonnay
Are you wanting to do this inside an Xbase++ application or in a web browser?

Can I assume that you have your own web server?

Are you using Xbase++ and Xb2.Net as your web server or is it IIS or Apache?

Jack Duijf submitted code for an HTML editor long ago.
You can search the BB for this.

Re: Multipart form post

Posted: Sat Dec 29, 2012 11:37 am
by BruceN
yes... we want to upload images to our own web server (running NGNIX) from our xbase program. We're using the loadfromURL() function to directly upload text now. Can't figure out how to use that fcn to upload images (jpg format).

I'll look for Jacks editor.

tnx

Re: Multipart form post

Posted: Sat Dec 29, 2012 11:44 am
by rdonnay
You cannot upload images using LoadFromURL().

This has to be done from inside a web browser.
It requires user interaction for selecting the local file.
Is that acceptable?

You can embed a web browser in your app with DCHTMLVIEWER and then load the form into the web browser for uploading the file.

I'll work on a sample program for you if this is an acceptable method for you.

Re: Multipart form post

Posted: Sun Dec 30, 2012 7:50 am
by BruceN
I believe it will. As always... thanks.

Couldn't survive without you guys :)

Re: Multipart form post

Posted: Mon Dec 31, 2012 8:06 am
by patito
Hi

Look at this link, this can help,
You can do multipart form post with class Tserverxmlhttpresquest or
activex Createobject("MSXML2.ServerXMLHTTP")

which can be downloaded from this example

Testing IPicture and TServerXMLHTTPRequest together
http://www.xbwin.com/forum.html
news.xbwin.com/ot4xb.examples

Best Regard
Hector Pezoa