lilalo
annotate l3-upload @ 117:9bb58a1eee2b
l3prompt minifix $_[0] -> $ARGV[0]
author | igor |
---|---|
date | Mon Mar 10 01:30:07 2008 +0200 (2008-03-10) |
parents | 8287cb3530de |
children | 58c869722fd0 |
rev | line source |
---|---|
igor@113 | 1 #!/usr/bin/perl |
igor@113 | 2 # |
igor@113 | 3 |
igor@113 | 4 use CGI; |
igor@115 | 5 $upload_dir = "/var/www/l3shot"; |
igor@113 | 6 $query = new CGI; |
igor@113 | 7 |
igor@113 | 8 $filename = $query->param("photo"); |
igor@113 | 9 $filename =~ s/.*[\/\\](.*)/$1/; |
igor@113 | 10 $upload_filehandle = $query->upload("photo"); |
igor@113 | 11 |
igor@113 | 12 my $convert=""; |
igor@113 | 13 if ($filename =~ s/.xwd$/.png/g) { |
igor@113 | 14 $convert="|xwdtopnm|pnmtopng"; |
igor@113 | 15 } |
igor@113 | 16 |
igor@113 | 17 open UPLOADFILE, "$convert>$upload_dir/$filename"; |
igor@113 | 18 binmode UPLOADFILE; |
igor@113 | 19 while ( <$upload_filehandle> ) |
igor@113 | 20 { |
igor@113 | 21 print UPLOADFILE; |
igor@113 | 22 } |
igor@113 | 23 |
igor@113 | 24 close UPLOADFILE; |
igor@113 | 25 |
igor@113 | 26 print $query->header ( ); |
igor@113 | 27 print <<END_HTML; |
igor@113 | 28 Upload complete |
igor@113 | 29 END_HTML |
igor@113 | 30 |
igor@113 | 31 |