Mike,
All in order in your code. I use same way to send ZIP files to my web server.
My code looks like you.
Set Procedure To wwHTTP AddIt
lcTempPath = Sys(2023)
lcZIPFilename = Addbs(lcTempPath)+Sys(3)+".zip"
lcUploadURL = "
http://www.techdata.com/upload.wcslcAdminPass = "SomeSecretWord"
oHTTP = Createobject("wwHTTP")
*** Set mode to multi-part form
oHTTP.nHttpPostMode = 2
*** Post a file and a regular form variable
oHTTP.AddPostKey("File",lcZIPFilename,.T.)
*** Post Admin Pass as variable
oHTTP.AddPostKey("AdminPass",lcAdminPass,.F.)
Wait "Please wait... request processing..." Window Nowait
lcHTML = oHTTP.HTTPGet(lcUploadURL)
oHTTP.HTTPClose()
And On server end
lcfilebuffer = REQUEST.getmultipartfile("File",lcfilename)
lcadminpass = REQUEST.getmultipartformvar("AdminPass")
*** Now dump the file to disk
file2var(lcfilename,lcfilebuffer)
Your mistakes might be
1) program can't found "ACCESSTEMP.TXT" on disk. Use FULLPATH() or variable with fullpath
OHTTP.ADDPOSTKEY("AccessUpload", "c:\temp\ACCESSTEMP.txt", .T.)
I thinking error there.... Send for test FILE, and simple var.. check does variable transmitted success.. if file is empty.. check fullpath and file exist.
OTher just notes:
2) I reccomend to use XML instead TXT/DAT file.. because in some cases your tables could have MEMO fields.. and you will need separately encrypt DBF/FPT files.
3) When you use MEMO(Binary) XML encode with Base64. XML is good way.. It might looks overdata.. but its real usefull
4) Also. as transaction result you can send back to your client (which send files to server) XML formatted response (text/xml).
Denis
>Denis:
>
>I have put in the details of my application. I have not used XML because I can't get that to work at all and from what I can see it doesn't make the files any smaller anyway.
>
>So I have used code as below.
>
>I had expected that this would put a file called accesstemp.txt up on my web server. The code runs without error but there is nothing on the web server after it completes.
>
>Can you see what I am doing wrong? Thanks
>
>Mike Smith
>
>
>FFF = FILETOSTR("c:\temp4\access1w.dbf")
>STRTOFILE(FFF, "ACCESSTEMP.TXT") && Writes the contents of a character string to a file.
>
>OHTTP = CREATEOBJECT("wwIPstuff")
>LNRESULT = OHTTP.HTTPCONNECT("
www.doncasteroffice.net/rentmast")
>
>IF LNRESULT # 0
> WAIT WINDOW "Something is wrong"
> RETURN
>ENDIF
>
>OHTTP.NHTTPPOSTMODE = 2 && multipart forms
>OHTTP.ADDPOSTKEY("AccessUpload", "ACCESSTEMP.txt", .T.)
>* "AccessUpload" is key value,
>* "ACCESSTEMP.txt" is a file name (because oHTTP.nHttpPostMode = 2) multipart forms,
>* .t. means the second parameter is a file name that is to be uploaded to the server
>
>WAIT "Please wait .... request processing .... " WINDOW NOWAIT
>LCHTML = OHTTP.HTTPGET("
www.doncasteroffice.net/rentmast")
>OHTTP.HTTPCLOSE()