Problem :
When displaying the submissions results whithin a table, the file path is wrong if you use the private file system. (ie: http://mysite.com//var/files/myfile.ext)
On the other hand, the submission view tab will display the file path correclty since it uses the webform_file_url function (ie: http://mysite.coml/system/files/webform/myfile.ext).

Solution :
Use the webform_file_url function for the table display.

In "components/file.inc" :

531 function _webform_table_data_file($data) {
532   $output = '';
533   $filedata = unserialize($data['value']['0']);
534   if (!empty($filedata['filename'])) {
535 
536     // FIX
537     //$output = '<a href="'. base_path() . $filedata['filepath'] .'">'. $filedata['filename'] .'</a>';
538     $output = '<a href="'. webform_file_url($filedata['filepath']) .'">'. $filedata['filename'] .'</a>';
539     $output .= ' ('. (int)($filedata['filesize']/1024) .' KB)';
540   }
541   elseif (!empty($filedata['error'])) {
542     $output = $filedata['error'];
543   }
544   return $output;
545 }

Since I saw it on the 6.29 version i doubt this is still a problem on newer versions.

Comments

DanChadwick’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

Closing for lack of activity. The 6.x branch is receiving critical bug fixes only.