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,
amt.

perlcheat

In reply to file upload form by amt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.