小编Mik*_*ikz的帖子

使用 Shiny 时出现 413 请求错误

我正在通过闪亮开发 Web 应用程序。

我正在尝试使用闪亮的 fileinput() 上传我的文件。

我有我的代码工作。我最初尝试上传 1.38KB 的文件并且工作正常。

后来当我尝试上传大约 1.58MB 的文件时,它抛出了一个错误,

>   >      <html>  <head><title>413 Request Entity Too Large</title></head>  <body bgcolor="white">  <center><h1>413 Request
> Entity Too Large</h1></center>  <hr><center>nginx/1.12.1</center> 
> </body>
Run Code Online (Sandbox Code Playgroud)

谁能帮我,我怎么能避免这个错误?

下面是我正在使用的 UI 和服务器的代码。

ui <- fluidPage(

  # App title ----
  titlePanel("Uploading Files"),

  # Sidebar layout with input and output definitions ----
  sidebarLayout(

    # Sidebar panel for inputs ----
    sidebarPanel(

      # Input: Select a file ----
      fileInput("file1", "Choose CSV File",
                multiple = TRUE,
                accept = c("text/csv",
                           "text/comma-separated-values,text/plain",
                           ".csv")),

      # …
Run Code Online (Sandbox Code Playgroud)

r shiny shinydashboard

3
推荐指数
2
解决办法
1538
查看次数

使用下载处理程序将 ggplot 图像保存为闪亮的

我正在闪亮中开发一个应用程序。在闪亮中,我使用操作按钮渲染一个简单的绘图。我添加了一个下载按钮来下载用户界面中现在的绘图。从我的代码(plot3)

我尝试了下面的代码来保存图像,但出现错误

未找到绘图输入。

任何人都可以建议我哪里出错了。

下面是我的代码供参考。用户界面:

ui <- tabItem(tabName = "models2",
        fluidPage(
          fluidRow(
            infoBoxOutput("overview")
          ),
          fluidRow(
            actionButton("result1","Generate Result"),
            downloadButton('downloadPlot','Download Plot'),
            plotOutput("plot3")
          )
        ))
Run Code Online (Sandbox Code Playgroud)

服务器

server <- function(input,output,session{
 output$overview <- renderValueBox({
      valueBox(
        paste("91"),"Overview",icon=icon("hourglass"),
        color="green"
      )
    })
  observeEvent(input$result1,{
  output$plot3  <- renderPlot({
    ggplot(data=timedata, aes(x=dat1, y=yes, group=3))+ 
      geom_point(shape=1)+
      coord_cartesian(xlim=c(dat1_xlowlim,dat1_xhighlim))+
      labs(title="Probability",x="Date",y="True probability")  
  })
  })
  output$downloadPlot <- downloadHandler(
    filename = function(){paste(input$plot3,'.png',sep='')},
    content = function(plot3){
      ggsave(plot3,plotInput())

    }
  )
})
Run Code Online (Sandbox Code Playgroud)

另外,要注意的是我的shiny 和R 工作室都在R 环境中。

r ggplot2 shiny

3
推荐指数
1
解决办法
6371
查看次数

标签 统计

r ×2

shiny ×2

ggplot2 ×1

shinydashboard ×1