
mboudreau at press
Mar 18, 2002, 12:26 PM
Post #5 of 13
(4999 views)
Permalink
|
That's not it. I'm able to access all the values of the %fdat hash from code within the fragment called by "Execute". In fact, I can make the fragment display the name of the file uploaded from my desktop, but for some reason embperl can't "read" it. At 3/18/02 12:58 PM, Ed Grimm wrote: >frag1.epl runs in a different namespace, where %fdat does not exist. >If you set EMBPERL_PACKAGE, it supposedly runs everything in that >namespace, but I've not yet gotten flawless results with this (I'm doing >a bunch of non-standard stuff; this could be my problem.) > >Ed > >On Mon, 18 Mar 2002, Michael Boudreau wrote: > > > 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 > > ================================================= > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: embperl-unsubscribe [at] perl > > For additional commands, e-mail: embperl-help [at] perl > > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: embperl-unsubscribe [at] perl >For additional commands, e-mail: embperl-help [at] perl ================================================= 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: embperl-unsubscribe [at] perl For additional commands, e-mail: embperl-help [at] perl
|