Native file uploading

0
Im working on a native selfservices app for my company witch requires uploading documents in the requests,i did use the native file document module and worked just fine until i discovered an issue with the app witch is syncing that results in downloading all the attachments by all the users to every user when logging in, witch resulted in slower starting and the app size being huge.I tried turning all the sync types to online but then i was not able to use the native file documents module actions to upload files anymore since they require a nanoflow to work and i face some issues working around it : ( .any ideas on how to make it work or what is the best practice in my case?
asked
2 answers
0

You can’t solve this only with XPath if everyone has read access, because offline sync will download everything the user can read. If all users must see all documents but should download only their own, the file entity must be online-only (not synced). When a user taps an attachment, call a microflow that checks ownership: if the file belongs to the user, allow download; otherwise, show a message like “You can view metadata, but you can’t download this file.”


answered
0

You can use offline sync, no need to resort to online only.


Probably not necessary and not desired for security and performance for everyone to have all uploaded files of all people on their device.


You can change the sync config to sync only files uploaded by the user, by setting an association to User or Account on your document entity. That way, users only keep their own documents on the device. Also, if these documents are processed in your app, once they reach a certain status they may no longer be relevant to be synced to the device, you could put that too in the sync config XPath.


If the documents only need to be uploaded and not referenced anymore after syncing, set the sync config to 'nothing (clear)' for the document entity, this turns the sync into a one way upload of new files to the backend, no files will be downloaded from the backend to any device. NativeFileDocuments itself requires that setting for its own logs to prevent clutter on the devices.


answered