Our /file/verify Robot

Verify the file type

🤖/file/verify verifies your files are the type that you want.

Usage example

Scan the uploaded files and throw an error if they are not images:

{
  "steps": {
    "scanned": {
      "robot": "/file/verify",
      "use": ":original",
      "error_on_decline": true,
      "error_msg": "At least one of the uploaded files was not the desired type",
      "verify_to_be": "image"
    }
  }
}

Parameters

  • use

    String / Array of Strings / Object required

    Specifies which Step(s) to use as input.

    • You can pick any names for Steps except ":original" (reserved for user uploads handled by Transloadit)

    • You can provide several Steps as input with arrays:

      "use": [
        ":original",
        "encoded",
        "resized"
      ]
      

    💡 That’s likely all you need to know about use, but you can view Advanced use cases.

  • error_on_decline

    Boolean ⋅ default: false

    If this is set to true and one or more files are declined, the Assembly will be stopped and marked with an error.

  • error_msg

    String ⋅ default: "One of your files was declined"

    The error message shown to your users (such as by Uppy) when a file is declined and error_on_decline is set to true.

  • verify_to_be

    String ⋅ default: "pdf"

    The type that you want to match against to ensure your file is of this type. For example, image will verify whether uploaded files are images. This also works against file media types, in this case image/png would also work to match against specifically png files.