Open file from fileserver on client side with Shiny App in R

shiny

#1

Hi!

I have a Shiny App running on a local server and a local fileserver from/to which the app modifies files.

I would like for clients connecting from the same network to open this files on their computer (client side) through the Shiny App. My current option opens the file on the server. Within server:

  observeEvent(input$openRadioButton,{
    shell.exec("fileToOpenOnClientComputer.xlsx"))
    })

Would it be possible to open the file on the client side? As R is not installed in the clients, can we tell Shiny to run a cmd command to open the file?

I know this questions reflects lack of client-server architecure understanding so any good reference will be much appreciated!

Thanks.


#2

HI @alvaropica

I'm going to make the assumption that the shiny server is not on the clients' computers as they do not have R installed.

I believe you will run into web browser limitations. To my understanding, browsers are not allowed to execute shell scripts locally on the clients computer (security risk).

My best guess is to provide a file path for them to paste into their file browser, where they could find the file. You could also download the file for them from the shiny app. Browsers have the "open this file you just downloaded" routine handled.

You could also open a new table with the file:// protocol pointing to the file. Might not work too well with excel files but will work great with pdfs. https://stackoverflow.com/questions/22535148/how-to-open-local-file-in-browser

Hope this helps,
Barret


#3

Thanks for your answer Barret.

I see the limitation you mention.

The problem is the client ocasionally would like to make some modification on the files. By opening them locally from the brower , modify and save this would be done.

However, I see that opening in the way you suggest is the more I will be able to achieve by using this shny system.

Thank you!!