[% USE JSON; SET form = CPANEL.FORM; SET fileName = ""; FOREACH u IN form; IF u.value == "upload"; USE String u.key; SET name = String.remove("file-"); fileName = name.remove("-key"); END; END; SET error = ""; SET warning = ""; SET file_content = execute ('Fileman', 'upload_files', { 'overwrite' => 1 }); IF file_content && file_content.status && file_content.data.uploads && file_content.data.uploads.0.status == 1; SET fileName = file_content.data.uploads.0.file; ELSE; SET error = file_content.errors_as_string(); END; %] [% IF !error %] [% ELSE %]