Date:  09/02/2017 09:25:06 PM Msg ID:  004894
From:  Art Bergquist Thread:  004894
Subject:  Poll until file exists on server
Hi,
 
I've got a web page in which I programmatically create an .html file in a certain folder/directory on the server.

My client has ActivePDF's DocConverter running on the server; DocConverter watches that folder/directory so that anytime an .html file gets created there, DocConverter automatically generates a .PDF file from the .html file.
 
The issue is that when the web page displays with a hyperlink to the .PDF file, the .PDF file has not always been generated yet (in fact, most of the time, the .PDF is not immediately available).
 
I'm looking to implement JavaScript in the window.onload event to poll the server to see when the file exists.  I've got a function to see if a file exists.  What I'm currently researching is how to pass the name of the .PDF file from the VFP code in the .FWx to the JavaScript in the window.onload event (in the same .FWx).
 
I implemented the following line immediately after initializing the memory variable for the name of the generated .PDF file:
 
  Session.SetVar('generatedPdfFileName', m.lcWebFile)
 
but when the following code gets called from the window.onload event:
 
     alert(session.getAttribute("generatedPdfFileName"));
 
it throws an "Uncaught ReferenceError: session is not defined" error.
 
Any thoughts? 
 
TIA,
 
Art Bergquist