Friday, March 22, 2013

Using file:// Protocol with PeopleCode ViewAttachment()

We use the PeopleCode ViewAttachment() function a lot to download files to the user. In the 8.49 PeopleBooks, the only protocol mentioned for the file source is FTP (or the database). So we have always assumed the file has to be stored on an ftp server. As of tools 8.53, ftp, sftp, ftps, http and https are also supported. Note that there is no mention of file:// in 8.49 or 8.53. However, a recent comment on Jim Marion's blog mentioned using  file://. That would be great for us because we are often displaying files that we have first transferred from non-ftp storage or created on the fly. Our Application Servers are on Windows. but we have to transfer the file to an ftp server and pick it up from there rather than just putting it in a temporary Windows file folder.

So I gave file:// a test and found that it works! Here is the test code I used to download a log file from the Application Server.

&usrFilename = "APPSRV_0102.LOG";
&path = "file:///D:/psfs/fsfstst/logs";
&rtn = ViewAttachment(&path, &usrFilename, &usrFilename);

Let me know how it works for you.

No comments:

Post a Comment