Curiouser and curiouser. If I merely change the fragment from

    [- if ( $fdat{UploadFile} ) {

          open (FILE, "> tmpfile.txt") or die "can't open: $!";
          print FILE $buffer while read($fdat{UploadFile}, $buffer, 32768);
          close (FILE) or die "can't close: $!";
       }
    -]

to
    [- $UploadFile = $fdat{UploadFile}; -]
    [- if ( $UploadFile ) {

          open (FILE, "> tmpfile.txt") or die "can't open: $!";
          print FILE $buffer while read($UploadFile, $buffer, 32768);
          close (FILE) or die "can't close: $!";
       }
    -]

then the upload works.


>Date: Mon, 18 Mar 2002 10:31:38 -0600
>To: [EMAIL PROTECTED]
>From: Michael Boudreau <[EMAIL PROTECTED]>
>Subject: file upload
>
>I'm having a problem with a file upload when the "read" function is in an 
>embperl fragment called by the "Execute" method.
>
>Here's a simplified version of my main file:
>
>--------------------------------------------
>[$ if $fdat{choice} eq "choice1" $]
>
>    [- Execute("frag1.epl"); -]
>
>[$ elsif $fdat{choice} eq "choice2" $]
>
>    [- Execute("frag2.epl"); -]
>
>[$ endif $]
>--------------------------------------------
>
>The file "frag1.epl" contains this:
>
>    [- if ( $fdat{UploadFile} ) {
>
>          open (FILE, "> tmpfile.txt") or die "can't open: $!";
>          print FILE $buffer while read($fdat{UploadFile}, $buffer, 32768);
>          close (FILE) or die "can't close: $!";
>       }
>    -]
>
>When I process the main file, I get a zero-length "tmpfile.txt", because 
>there is apparently nothing for the "read" function to read.
>
>However, if I move the "read" code out of frag1.epl and into the main file 
>(just before the "Execute" statement), the upload works.
>
>Any idea why this is happening?
>
>=================================================
>Michael Boudreau
>Senior Electronic Publishing Developer
>The University of Chicago Press
>1427 E. 60th Street
>Chicago, IL 60637-2954
>
>phone: 773 753 3298
>fax: 773 753 3383
>=================================================


=================================================
Michael Boudreau
Senior Electronic Publishing Developer
The University of Chicago Press
1427 E. 60th Street
Chicago, IL 60637-2954

phone: 773 753 3298
fax: 773 753 3383
================================================= 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to