Uploading / downloading files with Intraweb

Delphi 2010 / Intraweb 10

I am attempting to pop up a browser window with a PDF displayed, or at the very least, send a PDF File from the server to the browser. Both of the following code snippets fail because it cannot find the pdf.

For testing purposes, the PDF file is located C:\Temp\records\records.pdf (on the web server). Once I have the function working, the actual PDF files will be located on the web server in another folder.

WebApplication.SendFile('C:\Temp\records\records.pdf', True);

The error returned is "Cannot open file "C:\Temp\records\records.pdf". The system cannot find the specified file.

AddToInitProc('NewWindow("C:\Temp\records\records.pdf", "Records")');

Produces basically the same result.

In addition to a client receiving files from the web server, the client will also need to upload files to the server. I have not found any Intraweb documentation that helps with these specific problems.

Thank you in advance for your help.
Scott Gast
S2 Software, Ltd.


THis same error occurs whether I use OnAsyncClick or OnClick event.

Your file reference is incorrect.
See:
http://www.monien.net/blog/index.php/2006/11/how-to-prevent-locked-forms-after-sending-a-file-with-intraweb/

Please direct general IntraWeb questions that are not related to our components to Atozed software.

Bruno,

Thank you for the reply, but I guess I'm dense... I don't understand when you say "Your file reference is incorrect" . I looked at the link you provided and this is what I found:
 
     WebApplication.SendFile(‘c:\temp\test.xls’, true);

     The first parameter is the location of the file (do not use relative paths, esp. when running as ISAPI), the second  one tells to send the file as “attachment”. This will open a file dialog at the user’s browser.

It looks like my version:
   WebApplication.SendFile('C:\Temp\records\records.pdf', True);
should work... yes, the file exists on the server.  Also, I am not running ISAPI nor am I running IIS.

 

Please direct general IntraWeb questions that are not related to our components to Atozed software.