上传文件到 Liferay 服务器 [英] Uploading files to Liferay server

查看:38
本文介绍了上传文件到 Liferay 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Liferay 6.2 CE,我想添加一个简单的功能,管理员可以在其中将文件上传到 Liferay 服务器并在页面上添加到此文件的超链接.

I'm using Liferay 6.2 CE and I would like to add a simple functionality in which administrator can upload files to liferay server and add hyperlink to this file on the page.

我在 Liferay 的 6.1 文档中发现,在该版本中,管理员只需创建一个数据列表并在其中添加文件上传字段,如下所示:

I've found in Liferay's 6.1 documentation that in that version administrator could just create a data list and add File Upload field there as shown below:

不幸的是,在 Liferay 6.2 中这个字段不存在(我在这里很困惑是什么原因):

Unfortunately in Liferay 6.2 this field doesn't exist (I'm confused here what's the reason):

我还看到在创建新博客文章期间,有一个 HTML 浏览器内编辑器,具有添加图像的功能.按下后,用户可以从硬盘驱动器中选择一个文件,然后将其上传到 liferay 服务器并作为 标签添加到博客编辑器中,并链接到如下所示的目录:/documents/11469/0/UPLOADED_FILE.zip/.

I also saw that during new blog post creation, there is this HTML in-browser editor that has functionality to add images. When pressed, user can select a file from a hard drive which is then uploaded to liferay server and added as <img> tag to the blog editor and links to directory that looks like that: /documents/11469/0/UPLOADED_FILE.zip/.

但是用户上传普通文件(例如.zip文件)并不直观,通过使用图片上传器并手动编辑源代码将标签更改为普通 锚点.

But it's not intuitive for a user to upload normal files (e.g. .zip file), by using image uploader and manually editing the source code to change <img> tags to normal <a> anchors.

所以我的问题是我是否需要使用 API 以编程方式解决所描述的问题(我相信 DLFileEntryLocalServiceUtil 用于此目的)还是有其他方法可以使用 Liferay 功能来实现此目的?

So my question is whether I need to solve described problem programatically using API (I believe that DLFileEntryLocalServiceUtil is used for that purpose) or is there any other way to achieve this using liferay functionalities?

推荐答案

Liferay 6.1 的FileUpload"字段在 Liferay 6.2 中重命名为Document"字段.

The "FileUpload" field by Liferay 6.1 is renamed to "Document" field in Liferay 6.2.

这篇关于上传文件到 Liferay 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆