Mailing List Archive

Regarding EmbPerl file upload Issue -- enctype is giving undef value ... EmbPerl 2.3.0 & CGI 3.55
> Dear Sir,
>
> 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".
> Without enctype="multipart/form-data" and submit the form, can see the
> form values in %fdat variable. Can anyone tell me why its giving undef in
> the case of enctype
>
> If we remove enctype="multipart/form-data" form property, can see the form
> data (filename) after submiting the page.
>
> includng enctype="multipart/form-data" in form will give undef filename.
> Any idea?
>
> Here is the EmbPerl code
> if((defined $fdat{file} && $fdat{file}) && $fdat{upload}) {
> $filename = "/tmp/sample.txt";
> 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
>
> <form action="load.html" name="form1" method="post"
> enctype="multipart/form-data">
> <table>
> <tr class="cell4">
> <td>Select EXCEL rate sheet</td>
> <td><input type="file" name="file" value=""></td>
> </tr>
> <tr class="cell3">
> <td>&nbsp;</td>
> <td><input type="submit" name="upload" value="upload"></td>
> </tr>
> </table>
> </form>
>
> I couldn't any find solution from google. Could you please post this qn in
> your site and provide solution?
>
> I am using EmbPerl 2.3.0, CGI 3.55, Perl 5.10.1 and OS Linux


> Thanks,
> Ram