You are here

function _webform_table_data_file in Webform 5

Same name and namespace in other branches
  1. 5.2 components/file.inc \_webform_table_data_file()
  2. 6.2 components/file.inc \_webform_table_data_file()

Return the result of this component's submission for display in a table. The output of this function will be displayed under the "results" tab then "table".

Parameters

$data: An array of information containing the submission result, directly correlating to the webform_submitted_data database schema

Return value

Textual output formatted for human reading.

File

components/file.inc, line 397

Code

function _webform_table_data_file($data) {
  $filedata = unserialize($data['value']['0']);
  if (!empty($filedata['filename'])) {
    $output = '<a href="' . base_path() . $filedata['filepath'] . '">' . $filedata['filename'] . '</a>';
    $output .= " (" . (int) ($filedata['filesize'] / 1024) . " KB)";
  }
  elseif (!empty($filedata['error'])) {
    $output = $filedata['error'];
  }
  else {
    $output = "";
  }
  return $output;
}