Question

I am getting form data values as NULL in %fdat varible in EmbPerl, if we go for file upload and form property enctype="multipart/form-data".

Here is the EmbPerl code :

if(( defined $fdat{file} && $fdat{file} ) && $fdat{upload} )
{
         $filename = "/tmp/sample.txt";<br/>
         open (FILE, "> $filename") || die("open failed: $!");
         while (read($fdat{file}, $buffer, 32768)) {
         print FILE $buffer || die("print test: $!");
         close FILE || die("close test: $!");  
}

And HTML Code is :

<form name="form1" method="post" enctype="multipart/form-data" onsubmit="return validation();>
 <table>
<tr>   <td>Select EXCEL sheet</td>
    <td><input type="file" name="file" value=""></td>

  </tr>
    <tr>
   <td>&nbsp;</td>
    <td><input type="submit" name="upload" value="upload"></td>
   </tr>
 </table>
 </form>

I am using EmbPerl/2.3.0, CGI/3.63, Perl/5.10.1, Apache/2.2.22 and Linux OS.

Était-ce utile?

La solution

If you downgrade the CGI version to 3.37, then it will work.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top