Basically you can set loHttp.cPostBuffer directly to a string of any size you can get FoxPro to assign it:
loHttp = CREATEOBJECT("wwhttp") loHttp.cPostBuffer = FILETOSTR("c:\downloads\owc11.exe") && > 18megs lcHtml = loHttp.HttpGet("http://west-wind.com/wconnect/webcontrols/uploadimage.wcsx") ShowHtml(lchtml)
This will do a raw upload of the content which means it's just the file that gets sent - not a full form submission (multi-part formatted).
If you control the server on the other end you can just pick up the raw post buffer to pick up the file using the raw buffer.
Unfortunately this DOES NOT, upload a file in the same way as an HTML form upload does typically, but knowing that you can push a single big FoxPro string might allow you to do something with a memo field where you fully format the HTML request into a memo. Basically the code that sets up the memo has to fully format the POST buffer. So realistically the above will work only if you control the server yourself and you know you're sending a single file only up (with some additional data via querystring possibly).
THe good news though is that it works with a string > 16 megs as long as nothing else touches loHttp.cPostBuffer. This means you can build a raw response in a memo field, assign it to cPostBuffer and go. The part that takes some work is basically duplicating the POST data encoding that AddPostKey performs - IOW, the POST buffer has to be completely formatted before assigning to .cPostBuffer.
Let me screw around with this some more - I think we can probably can come up with a way to hack this by using a memo field and a way to encode the data another way (like adding an AddPostKeyMemo or something along those lines).
+++ Rick ---
Rick,
Can you help me understand your "(files uploaded can be larger)" below? In our desktop software I've got some code to send a file through http, but if it's over a certain size it bombs. It's not an IIS thing in this case, it happens during the 'addpostkey' method when it's doing the:
THIS.cPostBuffer = THIS.cPostBuffer + ;
"--" + MULTIPART_BOUNDARY + CR + ;
[Content-Disposition: form-data; name="]+tcKey+["; filename="] + tcValue + ["]+CR+CR+;
FILETOSTR(tcValue) + CR
Obviously, filetostr has a limit of 16mb and strangely it does convert to a string, but when it's added to another, a 'string too long' error comes up.
Maybe I'm missing something here. What are my options for sending a file > 16mb?
Sample code of mind:
...
.ohttp.nHTTPPostMode = 2
.ohttp.addpostkey("lmscode",GenerateLMSWebSecurityString())
.oHttp.AddPostKey("File",m.cPathFile,.T.)
IF ! .HTTPGet("FileUpload.acs","",.t.)
...
Thanks,
Sean
Javier,
It sounds like this is a SERVER error not a client error, and you really have no control over this from client code. I suspect the server has a limit on the size of POST data allowed to be posted to the server. Most servers have this configurable. You might also be bumping up against a server request timeout if the upload takes too long and goes beyond the server's request timeout. ALl of these are server configuration issues though, and you can't control these from the client. wwHttp just sends the data, the server has to receive it and process it.
There's no reason that this should not work from the wwHttp end of things. You should be able to send strings and files up to the size of VFP's string limit at 15 megabytes (files uploaded can be larger)
Hope this helps,
+++ RIck ---
Hi, I'm using wwIPSTuff to post data to a Web Server using the AddPostKey() method. All works fine, but, right now I have a problem when the data is too big.
The method works fine with small data, but when I try to send like 3-5 MB I get error 500 - Server Error.
How can I indicate the maximum size of the Post??
Best Regards.
Javier Leal.
Rick Strahl West Wind Technologies Where do you want to surf today? | Reader Version: 5.0 |
from Maui, Hawaii
