Where is file uploaded to


I am using RStudio server. When I use file upload for the use to browse and select the file to upload where does the file get uploaded to, the RStusio server?

From the shiny github repo:

# 2. For each file (sequentially):
#    a. Client tells server the name, size, and type of the file.
#    b. Client sends server a small-ish blob of data.
#    c. Repeat 2b until the entire file has been uploaded.
#    d. Client tells server that the current file is done.

So the web browser uploads the file to the server in small chunks until the entire file is uploaded and it does this for all files selected

Thank you for your reply.

I am trying to display a file in the GUI. I have to use readLines instead of reas,table() because the structure of the file is not very regular. I get the path to the file using getwd() and the file name using inFile = input$file

if I write readLines(paste(getwd(), "/", "textual name of the file". sep = "/") it works, but if I write
readLines(paste(getwd(). "/", inFile, sep = "/")) the file does not get displayed. Could you help me with this?

This issue is solved by using: readLines(inFile$datapath)
I would like to store the file in a dataframe to display using an editable table to edit and save the file. I am using rhandsontable. Is the readLines output a dataframe or I have to use data.frame(readLines(...))?

DF = data.frame(readLines(inFile$datapath))
rhandsontable(DF, width = 550, height = 300)
This is what I get when i run the code above:
cannot coerce class "c("rhandsontable", "htmlwidget")" to a data.frame
it seems that a gui component can not be converted to a dataframe. Is there any other way to create an editable table? should the editable table be created locally?, but I need to tell the user that if he choses "N" in the GUI, the file will be displayed for editing and afterwards it will be saved.

Have you read the documentation for readLines or read_lines? They can be found by typing ?readLines or ?read_lines into the r console.

In it they state:


A character vector of length the number of lines read.

So just using data.frame(readLines(...)) is just going to give you a data frame with a single character column.

I recommend you take a step back from trying to build your shiny ui and figure out how to parse your data in your local R session. If you don't have a firm grasp of what the data will look like, at least generally, then building a ui will be very difficult. I also suggest that you take the time to thoroughly read the documentation for the functions you are using as they typically have a lot of useful information and examples.

As for editing tables, I have never used rhandsontable before, but you can create ui elements that allow them to do things like select columns and filter rows from things like selectInput() and then just do the data frame manipulation in your server code. Again, I recommend you take a step back from the shiny side and figure out how to do this locally outside of the app. Debugging in your local session is much easier comparatively than debugging a shiny app.

1 Like

I tried to use;
edit(myParamsFile), and it works fine, but it does not run in the GUI in the order in which I need to appear, I am thinking that may be I can use a conditional panel. Any suggestions?

req(inFile) before read.table solves the issue "shiny error file must be a character string or connection". example:

      need(file_ext(inFile) %in% c(
      ), "Wrong File Format. The selected file is not a valid tab-separated PARAMS file try again!"))
    read.table(inFile$datapath, sep = '\t')

I have not been able to find the server file structure in my Linux machine. I can only see the folders I created locally. The RStudio IDE shows a file panel displaying the list of directories that I created in the PC. When I upload data, I can move files from one folder in the panel to another. My question is, is the directory structure displayed in the file panel the server directory structure and is it a replica of the file structure created by me in my Linux machine?