After scaning SuperSearch and trying all the ways, I can't figure out what's wrong.

Template file

<HTML> <HEAD> <TITLE>Upload</TITLE> </HEAD> <BODY> <FORM ACTION="/perl-cgi/upld" METHODE="POST" ENCTYPE="multipart/form- +data"> <INPUT TYPE="FILE" NAME="datei"> <P> <INPUT TYPE="SUBMIT"> </BODY> </HTML>

cgi file

#!/usr/bin/perl use warnings; use strict; use HTML::Template; use CGI; my $template = HTML::Template->new(filename => 'upld.tmpl'); my $cgi = new CGI; if ($cgi->param('datei')) { loadpic($cgi); exit; } print "Content-Type: text/html\n\n"; print q(<link rel="stylesheet" type="text/css" href="/pds392/style.css +"> <style type="text/css"></style>); print $template->output; sub loadpic { my $cgi = shift; my $file = $cgi->param('datei'); my $fh = $cgi->upload('datei'); print "<HTML><BODY>$file<br></BODY></HTML>"; open OUT, ">/tmp/1.pic.jpg"; my $buffer; while (read $fh, $buffer, 512) { print OUT $buffer; } print "Content-Type: text/html\n\n"; close OUT; exit; }

my $fh is allways undef and the script dies, but $file contains the choosen filename!!!
Why ? Can this behavior result of using this script with mod_perl ? Or is there something I've missed ?

Cheers

-----------------------------------
--the good, the bad and the physi--
-----------------------------------

In reply to CGI upload and mod_perl by physi

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.