There's a method defined on viewer that does the conditional.
Attach a file by drag & drop or click to upload