lilalo
annotate l3-upload @ 120:42d9af3c851c
minifix
author | igor |
---|---|
date | Thu Mar 13 12:22:31 2008 +0200 (2008-03-13) |
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 |