1

I want to keep web content in liferay database. Currently the JPGs are in another filesystem on another server, which I want to move to liferay database. Is there a way to bulk import these JPGs/web content to liferay db? One option I'm thinking is having a daily scheduled job to import new files from the filesystem. Curious to hear if anyone else has done it and how?

I found that there is a thing called as Database Hook. But as far as I understand, this lets you save to db only those files which you upload through the Image Gallery in Liferay. Which is a bit different from having to import files from another filesystem programmatically.

A.C
  • 197
  • 3
  • 17

1 Answers1

5

When you go to Liferay's Document Library (or image gallery in 6.0) you'll find a link "Access from Desktop" in every folder. This can be used to connect via WebDAV, so you can connect to Liferay's Document Library as if it was a Network share. Then just copy through batch files or explorer (drag&drop) and they'll end up in the doclib. Works in both directions.

For Liferay 6.1 you can also consider Liferay Sync, a Dropbox-like client that just synchronizes the document library with a folder on a local (remote from the server) system.

And the most complex variant (just to be complete here) is to use Liferay's API to insert documents programmatically. The advandage here is that you can also use it to tag and categorize the content during your import process, but it definitely is more work than just dragging and dropping files.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • Thank you Olaf for your answer. I'm deciding on writing a scheduler portlet that copies image files over daily to the liferay database from the outside file system to the database as blobs. – A.C Nov 29 '12 at 16:34
  • Olaf, if we drag and drop using the access from desktop option/webDAV, will the documents gets indexed? are they saerchable throught liferay lucene search? How will you sync HTML files where CSS and JS are also referenced in the file and they are relative to the server? – Sharana Nov 30 '12 at 00:24
  • They will get indexed. With regards to HTML/CSS/JS: Everything that you upload will be indexed, but it feels a bit weird to have these in the document library - I never thought of it as a plain repository for this kind of data. Not sure that the URLs will be resolvable (e.g. script src="main.js" might not resolve because the documents might not get canonical URLs that reflect their name and folder position - it's rather ids. – Olaf Kock Nov 30 '12 at 12:30
  • In liferay7 I got this problem: Document's content uploaded via WebDAV are not indexed, I had to reindex in the control panel to get the content indexed :( – anibal Aug 19 '16 at 19:00