链接到 Oracle ApEx 中的文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6705364/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Linking to a File in Oracle ApEx
提问by Datajam
I'm trying to create a report in Oracle ApEx that displays a list of files, and allows you to download them.
我正在尝试在 Oracle ApEx 中创建一个显示文件列表的报告,并允许您下载它们。
The files are being created by an external application and I have full control over where they are placed. Just now I am creating them in a subfolder of the ApEx images directory (C:\oracle\product\11.2.0\dbhome_1\apex\images). However, if I try to link to here, I just get a blank page - I've tried the #WORKSPACE_IMAGES#
and #IMAGE_PREFIX#
values as the link URL but it doesn't work.
这些文件是由外部应用程序创建的,我可以完全控制它们的放置位置。刚才我在 ApEx 图像目录 (C:\oracle\product\11.2.0\dbhome_1\apex\images) 的子文件夹中创建它们。但是,如果我尝试链接到这里,我只会得到一个空白页面 - 我已经尝试将#WORKSPACE_IMAGES#
和#IMAGE_PREFIX#
值作为链接 URL,但它不起作用。
There doesn't seem to be any way to automatically add a file to ApEx's flows_files.wwv_flow_file_objects$
table other than having an ApEx page do it (or upload it as a static file using the ApEx workspace). One thing I think might be possible is to manually insert a record into the table, but with the various IDs it requires this could be a minefield.
flows_files.wwv_flow_file_objects$
除了让 ApEx 页面执行此操作(或使用 ApEx 工作区将其作为静态文件上传)之外,似乎没有任何方法可以自动将文件添加到 ApEx 的表中。我认为可能的一件事是手动将记录插入表中,但是对于需要的各种 ID,这可能是一个雷区。
Has anyone else came across this problem? Linking to a file on any other webserver would be elementary, especially if it is placed under the document root.
有没有其他人遇到过这个问题?链接到任何其他网络服务器上的文件将是基本的,特别是如果它被放置在文档根目录下。
采纳答案by Datajam
Just to provide an answer to this in case anyone stumbles upon this question - I managed to resolve it by storing the files in the database as BLOB values. You can then set up ApEx to serve up these files by following the instructions here: http://download.oracle.com/docs/cd/E14373_01/appdev.32/e13363/up_dn_files.htm#CIHHEHCJ
只是为了提供一个答案,以防有人偶然发现这个问题 - 我设法通过将文件存储在数据库中作为 BLOB 值来解决它。然后,您可以按照以下说明设置 ApEx 以提供这些文件:http: //download.oracle.com/docs/cd/E14373_01/appdev.32/e13363/up_dn_files.htm#CIHHEHCJ
回答by Reybis Ceballos
If you use Apex Listener or ORDS (Oracle Rest Data Services)deployed in Tomcat, Apache or Glassfish. All you need to do is, first identify your context root (image folder or /i)in your application server.
如果您使用部署在Tomcat、Apache 或 Glassfish 中的Apex Listener 或 ORDS(Oracle Rest Data Services)。您需要做的就是首先在您的应用程序服务器中确定您的上下文根目录(图像文件夹或 /i)。
Then create a folder like 'assets', after that copy all the assets you need to reference in your Apex Application.
然后创建一个类似'assets'的文件夹,然后复制您需要在 Apex 应用程序中引用的所有资产。
In Apex, you have to reference these assets like '/i/assets/file-name.jpg'.
在 Apex 中,您必须引用这些资产,例如'/i/assets/file-name.jpg'。
All of this is for avoiding the weird Legacy path ( HTML DB <---> Apex 4.2)wwv_flow_file_mgr.get_file?p_security_group_id=123456789&p_fname=
when you add the static file in your DB either as a application file or workspace file. In Apex 5, you don't have this weird path, instead, you have a virtual path reference to a file.
当您将静态文件作为应用程序文件或工作区文件添加到数据库中时,所有这些都是为了避免奇怪的传统路径(HTML DB <---> Apex 4.2)wwv_flow_file_mgr.get_file?p_security_group_id=123456789&p_fname=
。在Apex 5 中,您没有这个奇怪的路径,相反,您有一个文件的虚拟路径引用。
回答by Tony Andrews
#WORKSPACE_IMAGES# returns a string like
#WORKSPACE_IMAGES# 返回一个字符串,如
wwv_flow_file_mgr.get_file?p_security_group_id=123456789&p_fname=
and is therefore only applicable to files stored in the Apex file table WWV_FLOW_FILES.
因此仅适用于存储在 Apex 文件表 WWV_FLOW_FILES 中的文件。
#IMAGE_PREFIX# returns a string like /i/
, and this can be used in links to download files stored in the Apex images folders. For example I can create a link like this:
#IMAGE_PREFIX# 返回类似 的字符串/i/
,这可用于下载存储在 Apex 图像文件夹中的文件的链接。例如,我可以创建这样的链接:
<a href="#IMAGE_PREFIX#"javascript/apex_4_0.js">Download some JS</a>
and when I run the page and click on it I can open or download that file.
当我运行该页面并单击它时,我可以打开或下载该文件。
It's not recommended to store your own files under the Apex images folder, because they could be overwritten during Apex upgrades. Instead you can define your own logical directory e.g. /myfiles/
on the app server pointing to a different location and then reference that instead like this:
不建议将您自己的文件存储在 Apex 图像文件夹下,因为它们可能会在 Apex 升级期间被覆盖。相反,您可以定义自己的逻辑目录,例如/myfiles/
在指向不同位置的应用服务器上,然后像这样引用它:
<a href="/myfiles/picture1.jpg">Download picture 1</a>