External Folders Outside of Local File Service

Hi everyone, thanks for the release of DF 2.0. It’s great!

Using the local file storage service, is it possible to access files privately outside of the Dreamfactory installation folder? E.g. if my Dreamfactory installation was at ‘/home/ubuntu/dreamfactory’ would it be possible to access folders in ‘/var/app/privatefolders/…’ for use in the local file service? I need to be able to call the folder and return a downloadable zip using the REST API.

Also, is there a good way to access the user’s ID from the user table, or do I have to run a query for it? I can access the authenticated username by $event[‘request’][‘headers’][‘php-auth-user’], but need the actual user ID;

PHP scripts have access to the entire file system, hence the extreme caution you must use when working with them. As long as your user running the web server process (usually www-data or apache) has access to the files, you will be able to access them via scripts.

To access the user’s id you’ll need to make an api call. user/session is the easiest way. Be sure to pass the session-token with it

Thanks, Drew.

I did see that in custom scripts I can access the entire file system, but is it possible using one of the file manager services?

I came across this link, “Access to local files storage (server)”, which suggests using a symbolic link. I’m going to try that and see if it works. I’m presently trying to find where dreamfactory’s “/files” directory lies.

Rob

symbolic links should work just fine. of course you’ll want to proceed with caution, as mentioned above.

The files service stores files in a the storage/app folder in your instance.
As an example, in a Bitnami Mac installation this would be
/Applications/dreamfactory-2.0.1-1/apps/dreamfactory/htdocs/storage/app

1 Like

Thanks again, Drew. I literally just found it and was about to post my findings here. Found it exactly where you said it would be. /{install directory}/storage/app/…"

Best,

Rob

1 Like