Gentlemen,
I have been asked to create a form to upload CSV of site surveys, and then emailing that file to my engineering department.
The HTML half of the script is as follows:
<form name=csvsurvey method=post action='/' enctype='multipart/form-da
+ta'>
<input type=hidden name=cmd value=main>
<input type=hidden name=module value=Customer>
<input type=hidden name=sub_cmd value=site_csv>
<input type=hidden name=sub_module value='Site Survey'>
<tr><td class=oatable>CSV File to Upload</td><td class=oatab
+le><input type=file name=upfile></td></tr>
<tr><td class=oatable>Notes(80 char max)</td><td class=oatabl
+e><input type=text name=upnote maxlength=80></td></tr>
<tr><td class=oatable colspan=2 align=center><input type=subm
+it value='Upload File'></td></tr></form>
The function that handles the incoming file is as follows:
sub site_csv() {
# Get CGI Variables
CGI::ReadParse(*form);
my $csv = $form{upfile};
$csv =~ s/\n/<br>/gi;
my $note= $form{upnote};
$tokens{MAIN} = "Included note: $note<br>";
$tokens{MAIN} .="<br>$csv<br>";
return $tokens{MAIN};
}
As you can tell I haven't even gotten to the point where I need to attach the file to an email. I want to be able make sure that I can recieve the information. The problem is that when I send my file, test.csv, printing out $form{upfile} prints the file name of the file that was uploaded, rather than the data.
TIA,