0
votes

I am developing this shiny app that needs to push a local file to a FTP. I am having trouble with this.

I am using ftpUpload() to upload, and file.choose() to grab the file path:

ftpUpload(file.choose(new = FALSE), "ftp.com/Abc", userpwd)

This worked fine when I run the app in my local machine. However after I deploy it on the web, it doesn't work. It disconnects the serve.

I am thinking the issues are on file.choose() since the interactive file selection dialog wouldn't show up.

Does anyone know how to get the file.choose() working, or any other solutions?

Again I am trying to push a local file to an FTP server through an online Shiny App.


Update:

I have checked the log and I get this error:

Warning in file(what, "rb") : cannot open file 'xt': No such file or directory
Warning: Error in file: cannot open the connection

I am using a windows. and this error won't appear when I run the app locally from my RStudio

1
Could you include the server log that has the specific error to your run instance?FAlonso
Do you know how to see specific error for an online app? This error only exists when the app is online. Currently when I try to call the function the whole app disconnected.Kim HQ Jin
there will be a folder within ShinyApps in your server called 'logs'. Whenever an instance is initiated, a log would get generated which is a dump to what you see in your console when you run the app locally. Take a look at the file and update your question with the error message.FAlonso
Thanks! Just updated with error.Kim HQ Jin

1 Answers

0
votes

A minimal working solution with fileInput.

# ui.R
ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      fileInput("myFile", "Choose your File")
        )
    ),
    mainPanel(
    )
  )
)

# server.R
server <- function(input, output, session) {

   observeEvent(input$myFile,{
    selectedFile <- input$myFile

    if (is.null(selectedFile))
      return(NULL)

      # Your code
      ftpUpload(selectedFile$datapath, "ftp.com/Abc", userpwd)

  })


}

Hope this helps.