Skip to contents

Validates that a file upload input contains a valid file with the expected extension. Checks file structure, minimum size (>500 bytes), and extension match.

Usage

ckfile(x, ext)

Arguments

x

Data frame. File upload input from [shiny::fileInput()], containing columns: `name`, `size`, `type`, `datapath`.

ext

Character scalar. Expected file extension without the dot (e.g., `"png"`, `"mp4"`, `"procreate"`). Case-insensitive comparison.

Value

Logical scalar. `TRUE` if file has correct structure, minimum size, and matching extension; `FALSE` otherwise.

See also

* [validator_step_1()] and [validator_step_2()] which use this function * [shiny::fileInput()] for file upload input format

Other validation: validator_step_1(), validator_step_2()

Examples

if (FALSE) { # \dontrun{
# Check if upload is a PNG file
ckfile(input$image_file, "png")

# Check if upload is a Procreate file
ckfile(input$raw_file, "procreate")

# Check if upload is an MP4 video
ckfile(input$video_file, "mp4")
} # }