macperl-webcgi-digest Friday, March 12 1999 Volume 01 : Number 004 [MacPerl-WebCGI] Handling multipart/form-data CGIs (file uploads) with MacPerl [MacPerl-WebCGI] MacPerl and multipart/form-data, file uploads (again) [MacPerl-WebCGI] MacPerl, multipart/form-data, CGI.pm Re: [MacPerl-WebCGI] MacPerl, multipart/form-data, CGI.pm Re: [MacPerl-WebCGI] SSI & HTTP headers Re: [MacPerl-WebCGI] SSI & HTTP headers Re: [MacPerl-WebCGI] MacPerl and multipart/form-data, file uploads (again) [MacPerl-WebCGI] Fudging the "Location:" bar in the browser ---------------------------------------------------------------------- Date: Wed, 10 Mar 1999 15:13:50 -0700 From: Christian Schaller <schaller@SPUDS.LPL.Arizona.EDU> Subject: [MacPerl-WebCGI] Handling multipart/form-data CGIs (file uploads) with MacPerl Howdy, folks. I'm wondering just how to handle multipart/form-data forms with MacPerl and the CGI module. In particular, I'd like to know how to deal with file uploads. I've got a simple little perl program that I use to test my forms; all it does is dump the returned successful controls' name and value pairs to the user via an on-the-fly HTML doc--it also returns the ENV data. It works perfectly well with regular forms, but when I specify that the enctype is to be multipart/form-data (and include a file via the <input type="file" ...> element), MacPerl returns an error like # CGI open of .:CGItemp10001: Invalid argument This is MacPerl 5.2.0_r4 and the CGI module that comes included. Any ideas? Thanks, Chris - ----------------------------------------------------------------------------- Christian J. Schaller Applications Systems Analyst Lunar and Planetary Laboratory schaller@spuds.lpl.arizona.edu The University of Arizona http://www.lpl.arizona.edu/~schaller/ Tucson, AZ 85721-0077 520/621-7200 ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org ------------------------------ Date: Wed, 10 Mar 1999 15:28:11 -0700 From: Christian Schaller <schaller@SPUDS.LPL.Arizona.EDU> Subject: [MacPerl-WebCGI] MacPerl and multipart/form-data, file uploads (again) Well, what do you know. I see now (according to MacPerl: P & E, the distributed version of CGI.pm that comes with MacPerl /can't/ handle file uploads. That'd be CGI.pm v 2.36. I see on CSPAN there's a CGI.pm v 2.49 available. Does anyone know it /that/ will do the trick? I suppose I could just download and install the thing myself and find out, huh? - --Chris - ----------------------------------------------------------------------------- Christian J. Schaller Applications Systems Analyst Lunar and Planetary Laboratory schaller@spuds.lpl.arizona.edu The University of Arizona http://www.lpl.arizona.edu/~schaller/ Tucson, AZ 85721-0077 520/621-7200 ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org ------------------------------ Date: Wed, 10 Mar 1999 16:16:42 -0800 From: Bruce Van Allen <bva@cruzio.com> Subject: [MacPerl-WebCGI] MacPerl, multipart/form-data, CGI.pm Christian J. Schaller wrote: >Well, what do you know. I see now (according to MacPerl: P & E, >the distributed version of CGI.pm that comes with MacPerl /can't/ >handle file uploads. That'd be CGI.pm v 2.36. > >I see on CSPAN there's a CGI.pm v 2.49 available. Does anyone know >it /that/ will do the trick? I suppose I could just download and >install the thing myself and find out, huh? I think we'd have heard on the MacPerl lists if a version of CGI.pm were finally able to handle file uploads on Mac. Lincoln Stein, the author of CGI.pm has a web site that might be enlightening (I don't have the URL handy -- he's connected with the Human Genome Project). Also, remember this: when you're using CGI.pm's functions to write your HTML form, and you want it to handle file uploads, be sure to use the function start_form_multipart() instead of plain start_form() [and check my capitalization]... - - Bruce ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Bruce Van Allen bva@cruzio.com 408/429-1688 P.O. Box 839 Santa Cruz, CA 95061 ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org ------------------------------ Date: Wed, 10 Mar 1999 20:00:12 -0700 From: Christian Schaller <schaller@SPUDS.LPL.Arizona.EDU> Subject: Re: [MacPerl-WebCGI] MacPerl, multipart/form-data, CGI.pm At 4:16 PM -0800 3/10/99, Bruce Van Allen wrote: >>I see on CSPAN there's a CGI.pm v 2.49 available. Does anyone know >>it /that/ will do the trick? I suppose I could just download and >>install the thing myself and find out, huh? > >I think we'd have heard on the MacPerl lists if a version of CGI.pm were >finally able to handle file uploads on Mac. As it happens, I downloaded 2.49, fixed the newlines, stuck it my site_perl, and it seems to work. I admit, however, that I haven't tried to do much with it. At the very least, CGI.pm 2.49 and MacPerl /can/ pull name=value pairs from a multipart/form-data encoded stream. That's more than 2.36 could do. >Also, remember this: when you're using CGI.pm's functions to write your >HTML form, and you want it to handle file uploads, be sure to use the >function start_form_multipart() instead of plain start_form() [and check my >capitalization]... Ah, no, I encode HTML by hand, even when it's going to be output by a perl program. >- Bruce - --Chris - ----------------------------------------------------------------------------- Christian J. Schaller Applications Systems Analyst Lunar and Planetary Laboratory schaller@spuds.lpl.arizona.edu The University of Arizona http://www.lpl.arizona.edu/~schaller/ Tucson, AZ 85721-0077 520/621-7200 ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org ------------------------------ Date: Thu, 11 Mar 1999 15:28:13 +1100 From: Iain Chalmers <bigiain@mightymedia.com.au> Subject: Re: [MacPerl-WebCGI] SSI & HTTP headers Peter R. Wiley wrote: > >I'd like to have a CGI called from an SSI set a cookie. I've tried to make >this work (on an Apache server) and I just can't. > >I thought that all one would need to do is: > > print "Set-Cookie: cookie=whatever\n\n"; > >but this does nothing at all, although it works just find in non SSI CGIs. Hi Peter, The problem you've got here is that apache parses the SSI, and includes the output of the SSI into the document before it sends it to the browser (the SSI only gets to write some text to stick in the middle of the html, and doesn't get to set any headers). No real easy answer to this, a couple of workarounds might be: use another SSI at the top of the page to set a cookie in a META tag have the SSI include a link to a cgi-script which sets the cookie (maybe an image?) generate the whole page as an SSI, and use non-parsed-headers (see the apache doco) I think if you _need_ to set the cookie on this page, you'll have to generate the whole page as a cgi instead. HTH Iain ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org ------------------------------ Date: Thu, 11 Mar 1999 08:38:05 +0100 From: Christian Huldt <chr@solvare.se> Subject: Re: [MacPerl-WebCGI] SSI & HTTP headers Iain Chalmers skrev/wrote: >Peter R. Wiley wrote: > >> >>I'd like to have a CGI called from an SSI set a cookie. I've tried to make >>this work (on an Apache server) and I just can't. [snip] >I think if you _need_ to set the cookie on this page, you'll have to >generate the whole page as a cgi instead. Or use a javascript to set it (if your on an intranet, so you know that the clients support it) Annika Åkerlind Huldt Götgatan, Sthlm Psykologkandidat SU http://www.psychology.su.se annika@solvare.se http://www.solvare.se/individer/annika This is art. Övertecknad hävdar härmed att allt innehåll i detta brev uteslutande publiceras för konstnärliga ändamål. Detta brev är alltså ett konstnärligt verk - en levande dokumentär utställning om mitt liv, mina ställningstaganden och mina bekantskaper. Alla nämnda namn, verkliga som overkliga, har avsiktligt nämnts i detta syfte. Därmed anser jag mig vara undantagen personuppgiftslagen, PUL. ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org ------------------------------ Date: Thu, 11 Mar 1999 09:06:30 -0500 From: Paul Miller <pmiller@spectrumtelecorp.com> Subject: Re: [MacPerl-WebCGI] MacPerl and multipart/form-data, file uploads (again) >Well, what do you know. I see now (according to MacPerl: P & E, >the distributed version of CGI.pm that comes with MacPerl /can't/ >handle file uploads. That'd be CGI.pm v 2.36. Hmm, I was able to make it work (partly--keep reading), just following the directions in CGI.pm. It would handle *very small* files as advertised (up to about 100k). Anything larger would cause all kinds of hanging, crashing, etc, even with memory partitions for MacPerl and my CGI bumped way up. It would be nice to have this work.... paul - ----------------------- pmiller@mv.mv.com ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org ------------------------------ Date: Fri, 12 Mar 1999 03:12:39 -0800 From: Rich Morin <rdm@cfcl.com> Subject: [MacPerl-WebCGI] Fudging the "Location:" bar in the browser I think there is a way to put a "fake" URL in the Browser's "Location:" bar, but I can't seem to find it in any of my references. For instance, if I wanted to link the user over to: http://www.abc.com/def?ghi=123 but have the "Location:" bar say http://www.abc.com/def Help? - -r - -- Rich Morin: rdm@cfcl.com, +1 650-873-7841, http://www.ptf.com/~rdm Prime Time Freeware: info@ptf.com, +1 408-433-9662, http://www.ptf.com MacPerl: http://www.ptf.com/macperl, http://www.ptf.com/ptf/products/MPPE MkLinux: http://www.mklinux.apple.com, http://www.ptf.com/ptf/products/MKLP ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org ------------------------------ End of macperl-webcgi-digest V1 #4 ********************************** ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" ==== to macperl-webcgi-digest-request@macperl.org