[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

macperl-webcgi-digest V1 #10




macperl-webcgi-digest     Wednesday, April 7 1999     Volume 01 : Number 010



[MacPerl-WebCGI] i am a new member
Re: [MacPerl-WebCGI] MacPerl and multipart/form-data, file uploads (again)
[MacPerl-WebCGI] CGI File Uploads [was: i am a new member]
Re: [MacPerl-WebCGI] MacPerl and multipart/form-data, fileuploads  (again)
Re: [MacPerl-WebCGI] CGI File Uploads

----------------------------------------------------------------------

Date: Mon, 05 Apr 1999 22:44:43 -0400
From: Robert C Niculita <rniculita@ameritech.net>
Subject: [MacPerl-WebCGI] i am a new member

hi there!
i have just subscribed to the list and i want to say hello to everyone.
i am new to the macperl community and macperl itself. my first request
to you is about file upload feature. can someone help me understand how
to write a script that will upload an image ( JPEG or GIF ).

thanks,
waiting, .....
rob


==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org

------------------------------

Date: Mon, 5 Apr 1999 20:21:18 -0700
From: Vicki Brown <vlb@cfcl.com>
Subject: Re: [MacPerl-WebCGI] MacPerl and multipart/form-data, file uploads (again)

CGI.pm version 2.5 has been released. I haven't tried it for uploads 
to Mac cgi, but I thought I'd mention it :-)

Note the upload caveats from the online docs:

The file upload feature doesn't work with every combination of 
browser and server. The various versions of Netscape and Internet 
Explorer on the
Macintosh, Unix and Windows platforms don't all seem to implement 
file uploading in exactly the same way. I've tried to make CGI.pm 
work with
all versions on all platforms, but I keep getting reports from people 
of instances that break the file upload feature.

http://stein.cshl.org/WWW/software/CGI/#upload_caveats
- ---
      |\      _,,,---,,_       Vicki Brown <vlb@cfcl.com>
ZZZzz /,`.-'`'    -.  ;-;;,_   Journeyman Sourceror: Scripts & Philtres
     |,4-  ) )-,_. ,\ (  `'-'  P.O. Box 1269  San Bruno  CA  94066
    '---''(_/--'  `-'\_) http://www.cfcl.com/~vlb  http://www.macperl.org

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org

------------------------------

Date: Mon, 5 Apr 1999 20:50:31 -0700
From: Bruce Van Allen <bva@cruzio.com>
Subject: [MacPerl-WebCGI] CGI File Uploads [was: i am a new member]

Robert C Niculita <rniculita@ameritech.net> wrote:
>my first request
>to you is about file upload feature. can someone help me understand how
>to write a script that will upload an image ( JPEG or GIF ).

Since you address this to the webcgi list, I assume you don't mean
uploading via FTP. Let's say you mean uploading by a visitor to your Web
site, using an HTML input form.

I have several sites through which users may upload files, including
images. It requires both the correct scripts on the server and certain
features in your form, plus a little awareness of security issues:

1. Your script has to be capable of correctly processing "multi-part" form
data. This takes some looping and tracking until the whole file all the way
to EOF is collected by the script.

2. Your HTML form must have something along these lines:

<form method='POST' enctype='multipart/form-data' action=[path/script.cgi]>
<P>File to upload: <input type=file>
...
</form>

The relevant things here are the attribute enctype='multipart/form-data' in
the opening <form> tag, and the input widget <input type=file> within the
form.

This was originally a Netscape 2.0 feature, so only the newer versions of
Explorer (4.0+) allow it; thus, Web surfers in much of the world won't be
able to do it. (I haven't tried it with iCAB yet.)

3. Because of security concerns, the file and its name have to be handled
correctly. Generally, the file should be placed on the server as a temp
file and then read and processed and/or copied to the directory in which
you want it to live; the temp file is deleted as soon as the CGI exits. The
name should be created by your script, not provided by the user (or their
computer). If you really want to allow the user to provide the filename,
then you should do some taint-check processing on the name.

Another security precaution I take is to gate the Web site, so 'not just
anybody' can upload.

Seems to me I've heard that some server administrators disallow file
uploads, but these are ones who probably also disallow custom CGIs in
general.

The best Perl approach is to use cgi-lib.pl by Steve Brenner or CGI.pm by
Lincoln Stein. Books and web sites about both. Get recent versions; only
the newer versions have been tweaked to work with both browsers
consistently.

Ain't simple, but can be very handy. Non-geek users love it when by two
clicks they can see their dog's picture on the Web. You could upload the
dog's bark, too. (I don't actually work with dog images online, but you you
get the, er, picture...)

CGI.pm can hide all of the gory details from you, if a bit
paternalistically (but really, THANKS, Dr. Stein!).

Good luck!

- - Bruce

~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Bruce Van Allen
bva@cruzio.com
831/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: Tue, 06 Apr 1999 00:01:53 -0400
From: Robert C Niculita <rniculita@ameritech.net>
Subject: Re: [MacPerl-WebCGI] MacPerl and multipart/form-data, fileuploads  (again)

- --------------0E559649648A77C33FFD1186
Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353"
Content-Transfer-Encoding: 7bit

vicki,

This is from the CGI.pm documentation:

"Using CGI.pm on non-UNIX platforms.

Macintosh

Most CGI.pm features work with MacPerl version 5.0.6r1 or higher under the
WebStar and MacHTTP servers. In order to
install a Perl program to use with the Web, you'll need Matthias Nuuracher's
PCGI extension, available at:

     ftp://err.ethz.ch/pub/neeri/MacPerl/

Known incompatibilities between CGI.pm and MacPerl include:

   1.The perl compiler will object to the use of -values in named parameters.
Put single quotes around this parameter
     ('-values') or use the singular form ('-value') instead.
   2.File upload isn't working in my hands (Perl goes into an endless loop).
Other people have gotten it to work. "

who has gotten it to work?


Vicki Brown wrote:

> CGI.pm version 2.5 has been released. I haven't tried it for uploads
> to Mac cgi, but I thought I'd mention it :-)
>
> Note the upload caveats from the online docs:
>
> The file upload feature doesn't work with every combination of
> browser and server. The various versions of Netscape and Internet
> Explorer on the
> Macintosh, Unix and Windows platforms don't all seem to implement
> file uploading in exactly the same way. I've tried to make CGI.pm
> work with
> all versions on all platforms, but I keep getting reports from people
> of instances that break the file upload feature.
>
> http://stein.cshl.org/WWW/software/CGI/#upload_caveats
> ---
>       |\      _,,,---,,_       Vicki Brown <vlb@cfcl.com>
> ZZZzz /,`.-'`'    -.  ;-;;,_   Journeyman Sourceror: Scripts & Philtres
>      |,4-  ) )-,_. ,\ (  `'-'  P.O. Box 1269  San Bruno  CA  94066
>     '---''(_/--'  `-'\_) http://www.cfcl.com/~vlb  http://www.macperl.org
>
> ==== Want to unsubscribe from this list?
> ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org

- --------------0E559649648A77C33FFD1186
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
vicki,
<p>This is from the CGI.pm documentation:
<p>"<font color="#2121FF">Using CGI.pm on non-UNIX platforms</font>.
<p>Macintosh
<p>Most CGI.pm features work with MacPerl version 5.0.6r1 or higher under
the WebStar and MacHTTP servers. In order to
<br>install a Perl program to use with the Web, you'll need Matthias Nuuracher's
PCGI extension, available at:
<p>&nbsp;&nbsp;&nbsp;&nbsp; <A HREF="ftp://err.ethz.ch/pub/neeri/MacPerl/">ftp://err.ethz.ch/pub/neeri/MacPerl/</A>
<p>Known incompatibilities between CGI.pm and MacPerl include:
<p>&nbsp;&nbsp; 1.The perl compiler will object to the use of -values in
named parameters. Put single quotes around this parameter
<br>&nbsp;&nbsp;&nbsp;&nbsp; ('-values') or use the singular form ('-value')
instead.
<br>&nbsp;&nbsp; 2.File upload isn't working in my hands (Perl goes into
an endless loop). Other people have gotten it to work. "<font color="#FF1C51"></font>
<p><font color="#FF1C51">who has gotten it to work?</font>
<br>&nbsp;
<p>Vicki Brown wrote:
<blockquote TYPE=CITE>CGI.pm version 2.5 has been released. I haven't tried
it for uploads
<br>to Mac cgi, but I thought I'd mention it :-)
<p>Note the upload caveats from the online docs:
<p>The file upload feature doesn't work with every combination of
<br>browser and server. The various versions of Netscape and Internet
<br>Explorer on the
<br>Macintosh, Unix and Windows platforms don't all seem to implement
<br>file uploading in exactly the same way. I've tried to make CGI.pm
<br>work with
<br>all versions on all platforms, but I keep getting reports from people
<br>of instances that break the file upload feature.
<p><a href="http://stein.cshl.org/WWW/software/CGI/#upload_caveats">http://stein.cshl.org/WWW/software/CGI/#upload_caveats</a>
<br>---
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |\&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _,,,---,,_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Vicki Brown &lt;vlb@cfcl.com>
<br>ZZZzz /,`.-'`'&nbsp;&nbsp;&nbsp; -.&nbsp; ;-;;,_&nbsp;&nbsp; Journeyman
Sourceror: Scripts &amp; Philtres
<br>&nbsp;&nbsp;&nbsp;&nbsp; |,4-&nbsp; ) )-,_. ,\ (&nbsp; `'-'&nbsp; P.O.
Box 1269&nbsp; San Bruno&nbsp; CA&nbsp; 94066
<br>&nbsp;&nbsp;&nbsp; '---''(_/--'&nbsp; `-'\_) <a href="http://www.cfcl.com/~vlb">http://www.cfcl.com/~vlb</a>&nbsp;
<a href="http://www.macperl.org">http://www.macperl.org</a>
<p>==== Want to unsubscribe from this list?
<br>==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org</blockquote>
</html>

- --------------0E559649648A77C33FFD1186--


==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org

------------------------------

Date: Tue, 06 Apr 1999 08:28:31 -0600 (CST)
From: w e b s l a v e <PPRODOEHL@qgraph.com>
Subject: Re: [MacPerl-WebCGI] CGI File Uploads

If interested, I've got a set of scripts for a gallery, you upload an
image, and then supply a title and caption, the users then see a list
of the images, see it in action here...

    http://www.michigandekhockey.com/gallery/index.cgi

I've got in working with Apache on FreeBSD and Windows NT (not the Mac yet :(

If people are interested, it might motivate me to tarball it and make it
available... with the warning that it's not the cleanest code ;]


Pete


==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org

------------------------------

End of macperl-webcgi-digest V1 #10
***********************************


==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe"
==== to macperl-webcgi-digest-request@macperl.org