From: Bob Romprey (zoot@farts.com)
Date: Fri Jun 22 2001 - 02:31:37 CEST
>Reply-To: mulinux@sunsite.dk
>Date: Mon, 18 Jun 2001 09:41:43 +0200
> Michele Andreoli <m.andreoli@tin.it> mulinux@sunsite.dk Re: [mu TECH] How do I upload my own web pages?
>On Sun, Jun 17, 2001 at 08:20:32PM -0700, Joshua Hudson nicely wrote:
>> The root for the web server is /home/httpd.
>> Put your files there. You cannot access /home/httpd with ftp. You
>> must transfer either locally or a combination of ftp and telnet.
>>
>
>muLinux has two server-root: /home/httpd (pygmy rustic server) and
>/usr/srv/thttpd (thttpd server). The thttpd is made active only when
>SRV is mounted.
>
>Michele
>
>
#####################################################
upload.html
##cut starts AFTER THIS line#########################
<html>
<body>
<form method="POST" action="http://your.url.here/upload.cgi" ENCTYPE="multipart/form-data">
File 1:
<input type="file" name="FILE1">
<br>
File 2:
<input type="file" name="FILE2">
<br>
<input type="submit" value="Upload!">
</form>
</body>
</html>
###end cut ABOVE THIS line##########
upload.cgi
#cut starts AFTER THIS line#########
#!/usr/bin/perl
#options
#NOTE: make sure path to perl above is correct
#be sure to chmod this script 755 after uploading or copying
# Your path to where you want your files uploaded.
# Note: NO trailing slash
$basedir = "/var/lib/apache/htdocs/Files";
# Do you wish to allow all file types? yes/no (no capital letters)
$allowall = "no";
# If the above = "no"; then which is the only extention to allow?
# Remember to have the LAST 4 characters i.e. .ext
$theext = ".gif";
# The page you wish it to forward to when done:
# I.E. http://www.mydomainname.com/thankyou.html
$donepage = "http://your.url.here/";
##############################################
# DO NOT EDIT BELOW THIS LINE #
##############################################
use CGI;
$onnum = 1;
while ($onnum != 11) {
my $req = new CGI;
my $file = $req->param("FILE$onnum");
if ($file ne "") {
my $fileName = $file;
$fileName =~ s!^.*(\\|\/)!!;
$newmain = $fileName;
if ($allowall ne "yes") {
if (lc(substr($newmain,length($newmain) - 4,4)) ne $theext){
$filenotgood = "yes";
}
}
if ($filenotgood ne "yes") {
open (OUTFILE, ">$basedir/$fileName");
print "$basedir/$fileName<br>";
while (my $bytesread = read($file, my $buffer, 1024)) {
print OUTFILE $buffer;
}
close (OUTFILE);
}
}
$onnum++;
}
print "Content-type: text/html\n";
print "Location:$donepage\n\n";
# end cut ABOVE THIS line###############
------------------------------------------------------------
Visit the world's greatest site at http://www.farts.com and listen to the fart
of the day. Also, get your very own farts.com E-mail account. FREE!!!!!
---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.dk
For additional commands, e-mail: mulinux-help@sunsite.dk
This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:19 CET