I am running into an inconsistency in file name. I am accessing an image file using fileInput:
. fileInput(inputId = 'file1', label = 'Select Image for edit', placeholder = 'JPEG, PNG, and TIFF are supported', multiple = TRUE, accept = c( "image/jpeg", "image/x-png", "image/tiff", ".jpg", ".png", ".tiff")) ),
.
In one shiny app, I get the temporary file stored in the temp directory with the SAME NAME as the original file and I must fix the file path. In another shiny app, I get the temporary file stored as 0.png.
I cannot find a flag or switch which controls this. Within each app, the files are consistent in the naming. The multiple = TRUE doesn't affect this.
I have written code which tests for the name, and uses the correct one:
if (length(input$file1)) {
curlengx <- nchar(input$file1[4]) - 5
suppressWarnings(
if (file.exists(normalizePath(file.path(input$file1[4])))) {
corname <- normalizePath(file.path(input$file1[4]))}
else if (file.exists(normalizePath(file.path(substr(input$file1[4],1,curlengx),paste(input$file1[1]))))) {
corname <- normalizePath(file.path(substr(input$file1[4],1,curlengx),paste(input$file1[1])))}
)
# print(corname)
output$plot1 <- renderImage({
list(src = corname)},
deleteFile = FALSE
)}