如何在r Shiny中访问file.info?

时间:2019-04-20 12:00:21

标签: r shiny

file.info在本地rstudio上有效,但是当我在r Shiny上部署时,它不起作用。似乎无法访问r闪亮的文件信息?还有其他方法可以捕获r Shiny中的文件创建日期。

我正在上传.jpg文件(照片),并且要确保照片不是旧照片,因此我正在从file.info中捕获cdate并与sysdate进行比较。它可以在本地计算机上工作,但是当我在闪亮的环境中部署时却无法工作。它为所有file.info详细信息提供了NA。

2019-04-20T11:48:25.353489 + 00:00 Shinyapps [841678]:大小为isdir模式mtime ctime atime uid uid gname uname grname 2019-04-20T11:48:25.353545 + 00:00 Shinyapps [841678]:IMG-20190306-WA0042.jpg不适用不适用不适用 2019-04-20T11:48:25.354488 + 00:00 Shinyapps [841678]:[1]“ 2019-04-20” 2019-04-20T11:48:25.355589 + 00:00 Shinyapps [841678]:警告:出现以下错误:缺少需要TRUE / FALSE的值 2019-04-20T11:48:25.360865 + 00:00 Shinyapps [841678]:84:watchEventHandler [/srv/connect/apps/EMPORIOS/app.R#1015]

observeEvent(input $ myFile,{     #df [nrow(intime)+1,] <-不适用

mfile <- input$myFile
#print(mfile$name)
upload<-    file.info(mfile$name)
print(upload)
filedate<- as.POSIXlt(upload$ctime, tz = "Asia/Kolkata")
filedate<- as.Date(filedate)
print(Sys.Date())
if (filedate !=Sys.Date()) {

shinyalert(
  title = "Old Picture",
  text = "Please upload today's picture",
  closeOnEsc = TRUE,
  closeOnClickOutside = FALSE,
  html = FALSE,
  type = "error",
  showConfirmButton = TRUE,
  showCancelButton = FALSE,
  confirmButtonText = "OK",
  confirmButtonCol = "#AEDEF4",
  timer = 0,
  imageUrl = "",
  animation = TRUE)

  return()

}

0 个答案:

没有答案