+# exec_download()
+#
+# Execute a HTTP download of a file
+#
+# Params: 1. Reference to user input hash
+# 2. Reference to config hash
+#
+# Return: Output of the command (Scalar Reference)
+
+sub exec_download($$)
+{
+ my ($data,$config) = @_;
+ my $physical = $data->{'physical'};
+ my $virtual = $data->{'virtual'};
+ my $dir = upper_path($virtual);
+
+ return return error($config->{'errors'}->{'no_download'},$dir,{FILE => $virtual}) if(-d $physical || -l $physical);
+
+ my $filename = file_name($virtual);
+
+ my $output = header(-type => 'application/octet-stream', -attachment => $filename);
+ $output .= ${ file_read($physical,1) };
+
+ return \$output;
+}
+