uploading

Joel Fentin joel at cts.com
Wed May 16 14:01:06 CDT 2001


~sdpm~
About a week and a half ago I asked you all how to upload files to the web.
I studied recommended URLs and tried the advice. Although I never found
anything that worked, I have made progress.

The following is a bare bones program that works in the laptop with a
personal server. It doesn't work when placed at the host. It can find the
source file, but can't seem to send it.

Any help appreciated.

BTW: The laptop has Windoz-95.

=====================================
#!/perl/bin/perl -w
#!/usr/local/bin/perl -w

#ul.pl
use CGI qw/:standard/; 
use CGI::Carp qw/fatalsToBrowser/;$| = 1;
$co = new CGI;
print $co->header();
print $co->start_html(-title=>'UPLOAD PAGE!');
print
$co->startform(-method=>'POST',-action=>'./ul.pl',-encoding=>'multipart/form


-data');
print $co->filefield('uploaded_file','starting value',50,100); 
print $co->submit(-name=>'button_name', -value=>'Do it!'); 
print $co->endform;
$filename = $co->param('uploaded_file');
print "--$filename--<br><br>";
open(INFILE,"<$filename");
binmode INFILE;

if(-e "dummy.fil")                              #if on personal server...
  {open(OUTFILE,'>../../htdocs/photos/yy.jpg')}
else                                            #if on internet...
  {open(OUTFILE,'>../../photos/yy.jpg');}
binmode OUTFILE;
while (read(INFILE,$buffer,1024)){print OUTFILE $buffer}
close (OUTFILE); 
close (INFILE); 

print "<img src='../../../photos/yy.jpg'>"; 
print "</html>";
#end of program===================================

--
Joel Fentin    tel: 760-749-8863    FAX: 760-749-8864
 
email: joel at fentin.com     web: Fentin.com

~sdpm~

The posting address is: san-diego-pm-list at hfb.pm.org

List requests should be sent to: majordomo at hfb.pm.org

If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.




More information about the San-Diego-pm mailing list