I am trying to use Shiny on a local server of ours, to build an app that allows the user to upload a .zip file containing an ESRI shapefile and associated files. Shiny server's fileInput can obtain the data, and when it does so it sotres it in a temporary directory & filename. That filename seems to always be a rather generic "0". If I by hand try to unzip file "0" it works. But if I try to do it programmatically with the R function unz (which I gather should work) it fails, the error message is that it 'cannot open zip file '0'. I"m not sure why. Can anyone help?
here is the code:
shinyServer(function(input, output) {
mySHPdata <- reactive({
inFile <- input$file1
if (is.null(inFile))
return(NULL)
print((inFile$datapath))
data<-read.table(unz(basename(inFile$datapath), "testme.shp"))
One has to extract the relevant files one by one, so here I am just illustrating attempting to open one of them. Anyone see why this does not work?