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

Re: [MacPerl-WebCGI] File uploading



At 8:24 PM 10/5/00, Adam Oliner wrote:
>Is it possible, using MacPerl, to have a form button that allows a 
>user to browse his or her HD, select a file, and have that file be 
>automatically uploaded? Would there be platform/browser limitations?
>
>If this cannot be done with MacPerl, is there some other method or 
>pre-packaged solution that would? What do you recommend?


Could be several solutions, but please clarify:

When you say using MacPerl, do you mean on the machine you're 
uploading _from_, or the machine you're uploading _to_?

If you're uploading to a remote web server running, say, UNIX, a CGI 
script written in Perl can do the job. The popular and reliable CGI 
module, which comes with the standard installation of Perl, has a 
fairly simple process for file uploads. The CGI script resides and 
executes on the server. The HTML page that has the button to push 
(enabling you to browse your local HD and select the file to upload) 
may be on the server or on your local disk. You could use any recent 
web browser. MacPerl wouldn't come into play. I routinely use this 
process for file uploads to enable clients and their visitors to add 
or change material in web sites, with both public and private access.

What if it's a remote server that happens to be a Macintosh? Well, so 
far, web/CGI file uploads to Macs running MacPerl don't work well or 
at all. I haven't tried this yet to a Mac running OS X, which comes 
with 'regular' Perl (v. 5.6 - the latest!). I don't deploy software 
on any Mac web servers, so this might have missed my attention, but 
I'm not aware of anyone systematically analyzing the problem with Mac 
web servers.

Until this is answered, an alternative way to use MacPerl (in your 
local machine) to handle uploads would be to:
a) write a MacPerl network tool; or
b) have MacPerl make an FTP program do it ("do Applescript...", or 
"use Mac::Glue...").

The button interface as well as the means of controlling the network 
transaction/FTP client would take much more coding than with a web 
page file upload CGI. But, you'd get to learn a bunch about 
networking and Mac-specific powers of MacPerl ;-)

Not sure I've hit the level of specificity of your question. To find 
out about CGI.pm: The author of CGI.pm, Lincoln Stein, has great 
online documentation, also written up in a useful book. Search on 
CGI.pm -- I don't have the URL handy.

HTH

1;

- Bruce

__Bruce_Van_Allen___bva@cruzio.com__Santa_Cruz_CA__

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