salesforcefile-accesslocal-files

Workarounds to access network drive files from Salesforce page?


I am trying to access a file in network drive from Salesforce record page/LWC:

ex. file://networkDriveName/FILES/...

and received error from all modern browsers:

"Not allowed to load local resource".

Lower the security setting may work but it is not a good idea.

I tried "Simple Web Server", it works, however, not the best option to implement for my needs.

Is there any other workarounds? Thanks in advance!


Solution

  • Browsers "sandbox" the environments. Website shouldn't have access to your local filesystem because that's allowing viruses and malware. Unless you're old Internet Explorer, then the browser let's your machine discover the net and vice versa.

    You could look into "files connect" SF feature if your files are stored on Google drive SharePoint etc? If it's literally a network drive without any apps on top of it it's possible your only option would be to craft a small program (maybe in Python, the "simple Salesforce" is pretty easy to use) or write some wrapper bash scripts around the sfdx commandline tool?

    What exactly you need to do. Is it for humans or for some scripted file upload. Maybe something fancier like "lightning out" app could pull it off. But I'd start with checking if SharePoint etc is good enough.

    Check out my https://stackoverflow.com/a/69265554/313628, especially the bit about cheesy Files Connect movie. At the very least you'll have a new term to Google around for.