MetalJepp has asked for the wisdom of the Perl Monks concerning the following question:

I know that my problem is related to the HTML I have written not sending the Post data to my Perl Script but I am breaking my head on the wall trying to figure this out.

The HTML:
<form method="post" action="C:\process_feedback1.pl">
Comments about this page
<textarea name="feedback" cols="46" rows="10" wrap="physical" id="feedback"></textarea>
File to Upload for this page<input type="File" name="file">
Proper Name of the File<input type="text" name="filename">

<input value="Send" type="submit"> <input type="reset">




And here is the Perl Code:
#!\perl\bin\perl.exe
use CGI ();
use MIME::Lite;
use Win32::OLE;

my( $query, $up_fil, $fd_bac, $nw_fil, @BR_Comments, $cnt, $headline, $BR_Comments );

print $ENV{QUERY_STRING}, "\n";

$query = CGI->new();

if ($query->param('feedback') eq "") {
print( STDOUT "Nothing came from the html page.\n");
}
$fd_bac = $query->param( 'feedback' ); #The Commemts from the User
$up_fil = $query->upload( 'file' ); #The File to Upload
$nw_fil = $query->param( 'filename' ); #The Filename

print( STDOUT "upload - $up_fil\tnew - $nw_fil\tfeedback - $fd_bac\n" );

#The Commemts that I need to strip down to the first sentence as de-noted by a period
@BR_Comments = split /\./, $fd_bac;
$cnt = scalar( @BR_Comments );
if ( $cnt == 1 ) {

$headline = substr($fd_bac, 0, 125);

} elsif ( $cnt > 1 ) {

$headline = $BR_Comments[0];
$headline = substr($headline, 0, 125);
}

IntEmail( $fd_bac, $up_file, $nw_fil, $headline );

Thanks for the help

Update - The action should have been set as http://windom/feedback/process_feedback.pl

Running on low fumes at this point due to the 16 hours of head smashing.

Replies are listed 'Best First'.
Re: HTML Post to Perl Script not working
by ikegami (Patriarch) on Sep 04, 2008 at 06:25 UTC

    (Note: You'll find it easier to just put your code in <c>...</c> tags.)

    Assuming your browser even executes the script, it don't think it will communicate with the script using CGI. CGI is a protocol used by web servers to communicate with applications it executes, but there's no web server involved in fetching file: URLs (which your browser probably assumes C:\process_feedback1.pl to be).

Re: HTML Post to Perl Script not working
by l.frankline (Hermit) on Sep 04, 2008 at 07:12 UTC

    Hi,

    You should put the perl file in the directory as specifiled in the webserver configuration to execute. The path C:\process_feedback1.pl may not be recognizable by the webserver and fails to execute.

    Besides, you should not mention the drive name "c:\" in the form action attributes, just mention the file name or with a directory followed by file name.

    Regards,
    Franklin

    Don't put off till tomorrow, what you can do today.

Re: HTML Post to Perl Script not working
by lamp (Chaplain) on Sep 04, 2008 at 07:19 UTC
    For uploading a file from html form, you have to set the 'enctype' in form tag.
    <form method="post" action="C:\process_feedback1.pl" enctype="multipar +t/form-data">
    And also check for the http server error log for more details.
    --lamp