How can I upload an image and save it to some directory in moqui?

I am trying to implement the functionality of loading an image instead of storing it in the database, I want it to be stored in my project's images directory, can you suggest ways to do this.

As per my current research, when I load an image it is stored in the database, I mentioned the EditExampleContent.xml file in the Example Moqui component.

Thanks in advance..!!

+3


source to share


1 answer


I recommend looking at the coverage of the Resource phases in the "Applications for Moqui" book from moqui.org (chapter 5). Saving to the local filesystem is simply using a different resource location prefix, i.e. something like file: instead of dbresource: (or even component: if the component is on the filesystem). Here is an example of this on the HiveMind wiki, where attachments to wiki pages are stored either in the database (DBDEMO widget space) or on the local filesystem (Wiki-DEMO space).



The main reason for putting things like this in a database or JCR content repository is that it is distributed across multiple servers in a pool. Using a local file system on the application server, unless it comes from the original repository and is the same across all application servers, is usually a bad idea. For production management, it is better to think of application servers as one-time use and use the database or content repository as permanent storage (with replication, backups, etc. for reliability).

0


source







All Articles