Focal Point
[CLOSED] Delivering files through WebFOCUS

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/775100452

September 30, 2009, 03:15 PM
jkyle
[CLOSED] Delivering files through WebFOCUS
I have some files in folders that I would like to make available to users, but the files are stored in protected folders so I cannot simply redirect the browser to the file on the server. I am looking for a way to deliver the file to the browser through FOCUS.

I see that FOCUS uses PG_file and PG_func to deliver PDFs and XLS, but I can't find any documentation on accessing those functions myself.

Is there any way to send static files to the browser from FOCUS?

Thanks!

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6.x
Windows
Output: Excel, PDF, HTML
September 30, 2009, 03:50 PM
Darin Lee
Not really. FOCUS can deliver records from a file, but there is no mechanism to grab a file where it exists and deliver it to a browser. In any case, it would need to access the directory the same way that a browser would, so I think that's a double dead-end.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
September 30, 2009, 05:31 PM
Waz
You could try ...

FILEDEF RTNFILE DISK {file location}

SET HTMLFORMTYPE = {filetype}

-HTMLFORM RTNFILE


You would have to test for each file type to see if it works.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 02, 2009, 08:32 AM
dhagen
Use can use the EDAGET command to deliver a file to the browser.

For example, if I have a file called "baseapp/filename.txt", the fex would be:
APP ENABLE
EX EDAGET TXT,baseapp/filename,T
  


FYI: this fex has to be a server based fex. I do not believe this command will work in MRE.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
October 14, 2009, 04:10 PM
jkyle
@Darin Lee: Our fexes have access to all the folders, but the browser should not.

@Waz: This is the direction we've been trying. It _almost_ works, but FOCUS mangles any file that wasn't generated in FOCUS originally before it gets to the browser. IBI tech support says "HTMLFORMTYPE" is unsupported in WebFOCUS.

@dhagen: This looks promising, but I cannot find very little documentation on it. Do you know where I can find more info? I keep getting a FILE NOT FOUND error, even though the file is definitely there.

Thanks for all your help.


WebFOCUS 7.6.x
Windows
Output: Excel, PDF, HTML
October 14, 2009, 04:56 PM
jkyle
I got EDAGET to work only as well as HTMLFORMTYPE/HTMLFORM. That is: WebFOCUS tries to send the file to the browser, but mangles the file before the browser gets it. The browser will attempt to open the file but cannot interpret it.

Any other suggestions?

Thanks again for any ideas. This is basic Web App 101 stuff, I don't know why this is so difficult in WebFOCUS.


WebFOCUS 7.6.x
Windows
Output: Excel, PDF, HTML
October 14, 2009, 05:03 PM
Waz
quote:
IBI tech support says "HTMLFORMTYPE" is unsupported in WebFOCUS


This is quite annoying, as there are many techniques stating the use of HTMLFORMTYPE, and to say that it is unsupported in WebFOCUS, is surprising.

I think there may be a giveaway that it is.
"HTMLFORMTYPE" is unsupported in WebFOCUS

Simplistically I think that it only works on text based files, not binary types.

You may also find that EDAGET is only supported for internal use, as this is what I found when I asked about EDAPUT.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 14, 2009, 05:11 PM
Waz
If your Webserver is on the same box as WebFOCUS, or at lease can access a location, could you just copy the file to a location accessible to the webserver.

The only issue after that would be removing the file later.

Also not sure if FOCCACHE could be used. (Don't think it is in 7.1)


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 14, 2009, 05:14 PM
jkyle
Thanks Waz, that's what I'm finding, as well: text-based files okay; binary-types no joy.

sad face.


WebFOCUS 7.6.x
Windows
Output: Excel, PDF, HTML
October 15, 2009, 01:18 AM
<JG>
use ASP or JSP depending on the APP server

That will download any filetype and ask the user to save it before opening.

Take a look at this post where I gave a solution for both methods

[SOLVED]How to change the suggested name of the file to be saved
October 16, 2009, 04:41 PM
dhagen
quote:
Originally posted by jkyle:
I got EDAGET to work only as well as HTMLFORMTYPE/HTMLFORM. That is: WebFOCUS tries to send the file to the browser, but mangles the file before the browser gets it. The browser will attempt to open the file but cannot interpret it.


What kind of files are these? I can figure out the proper syntax, but I need to know what you are working with.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
October 19, 2009, 05:44 PM
jkyle
@dhagen: PDF, jpg, anything really. The problem seems to be with binaries.


WebFOCUS 7.6.x
Windows
Output: Excel, PDF, HTML
October 19, 2009, 07:13 PM
Waz
I wonder if there is a way to send the files to the WebFOCUSxx/temp directory.

For those that do not know, this is where, for example, PDF reports are placed before returning to the browser.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!