HTTPUPLOAD - no human intervention

Topics: Developer Forum
Mar 2, 2012 at 8:09 PM
How can I use HTTPUPLOAD to automatically upload a textfile to server with no user intervention
When user prints, I capture it to a file and want to automatically upload to server
User is bitching it takes to long to upload all the files thruout the day.

By the way it takes about 1 second once user presses SUBMIT to upload (ITS FAST)
Its fast and works while using the existing HTTPUPLOAD using UPLOAD1.HTM it
WORKS FINE! ....BUT, user wants it to automatically upload. HELP pls!
I have tried ADO, WINHTTP, ETC all require user intervention
I have traced using debug, over and over !
I can not figure out where HttpUpload is getting the filenames, size, etc from inside of
ActiveVFP.prg  method:  oUpload.HttpUpload(oProp.AppStartPath+'temp')
from what I see, it parses varibles used in Upload2.htm in the demo.
<%
    oUpload=NEWOBJECT('AVFPhttpUpload')
 *set the maximum file size to allow for uploads
 oUpload.setmaxsize(999999999)
 * do the upload  
 lnFiles = oUpload.HttpUpload(oProp.AppStartPath+'temp')
%>                 
The Case Study
on the user side: i want to submit a file to server method ?action=upload&acct=1000 lchtmlout= oHTML.mergetext(lchtmlout)
  *************
  * user input filenames to upload
CASE oProp.Action=='upload'
  LOCAL lnFiles
  SET STEP ON
  lcFile=oRequest.querystring("acct")+[.txt]
 oSession.VALUE("File1",lcFile)
  oUpload=NEWOBJECT('AVFPhttpUpload')
  oUpload.setmaxsize(999999999) &&..set the maximum file size to allow for uploads
  * do the upload
  lnFiles = oUpload.HttpUpload(oProp.AppStartPath+'temp')
  lchtmlfile = 'dummy.htm'
  lchtmlout= FILETOSTR(oProp.HtmlPath+lchtmlfile)
  lchtmlout= oHTML.mergetext(lchtmlout)
I am sorry if this is a stupid question. Thanks for your help in advance
..Randy
Coordinator
Mar 2, 2012 at 8:52 PM

FTP might be better for automatically doing this.  Check the web for examples of using VFP with FTP.

(or check the web for using Classic ASP upload automatically.  That example should work with ActiveVFP too since we're using the Classic ASP binaryread method:

oRequest.BinaryRead(READSIZE)