Simplicty and flexibility!


How to upload images to different paths when using the richtext editor

Started by DG3 Development
You will need to Sign In to be able to comment on the Blog!

How to upload images to different paths when using the richtext editor

Earlier in an blog post, we showed how to set up file upload in richtext editor in DG3. This time we will tell you how to upload files to different directories based on a database field in a table or a user profile. To do this, you need DG3 0.17.1095 or newer. What we do is to combine livetext in url setting on the richtext and the new user extend table described in this blog post.

The key to how to do this is a new feature in upload url set in the rich text field. Now you can add a folder to the end of the url, and that will then be added to en end of the default upload url set in the fileupload module setting. This combined with the extended user profile, you can give each user of the system an individual folder to use for uploading their images.

Example of a setup of upload with user defined folder

Then you add a richtext field to you page and add the following urls:

Image browse url: /_upload/redactorimagebrowse/[{ user.myfolder }]/

Image upload url: /_upload/redactorimage/[{ user.myfolder }]/

Example using a field in the current table

Then you add a richtext field to you page and add the following urls:

Image browse url: /_upload/redactorimagebrowse/[{ maindata.CustomerPrefix }]/

Image upload url: /_upload/redactorimage/[{ maindata.CustomerPrefix}]/

You can use any combination possible in livetext to set a folder to use. You can also simply hard code a folder if you only want to separate the files for different forms. What happens in is that the folder is added to the default one, so you get a /static/defaultimagepath/youextrapath/image.png as the image source. Mind that you can not use a / in the extra path as that will indicate another parameter in DG3.


Written by DG3 Development 17/12/13 at 08:57:08 DataEase Generation 3