This is useful for many situations, such as:
The name of the submitted file is available in the environment variable
whose name is the same as file location. For example, if you set the file
location to be
abc.zip
, then
${abc.zip}
would give you the original file name passed from the browser (such as
my.zip
.) The name will not include the directory name portion.
Please note that some shells, such as dash, or /bin/sh provided by dash, do
not make such environment variables with special characters available to
child processes. Try using shebang like
#!/bin/bash
in shell script and use
$(printenv abc.zip)
to get the original file name.
File upload is optional. If a user chooses not to upload anything, Jenkins will simply skips this parameter and will not place anything (but it also will not delete anything that's already in the workspace.)
From the CLI, the
-p
option to the
build
command should take an empty value to read from standard input. (Only one
file parameter can be defined this way.)