JP Sama has asked for the wisdom of the Perl Monks concerning the following question:
well, with this i've got the following:#!/usr/bin/perl use CGI; use CGI::Carp 'fatalsToBrowser'; CGI::ReadParse(*in); my $homeurl = 'http://joao.warp.psi.br'; my $imagedir = '/www/joao/images'; my ($s,$m,$h,$mday,$mon,$year,$w,$y) = gmtime(time); my $id = $year.$mon.$mday; # save thumbnail my $thumb = &FileUpload($in{iddt}); open(MAKETHUMB,">$imagedir/$idt.gif") or die("Could not save $idt.gif"); print MAKETHUMB $thumb; close(MAKETHUMB); # save image 'idd' my $img = &FileUpload($in{idd}); open(MAKE,">$imagedir/$id.gif") or die("Could not save $id.gif"); print MAKE $img; close(MAKE); # the images are mine! my @files = glob("$id*.gif"); chown 'joao','fodas',@files; # upload file (used here to upload images) sub FileUpload { my ($formfield) = shift; my ($filename,$filesize,$filedata); # load query handle $query = $in{CGI}; if ($filename = $query->param($formfield)) { my $tmp = $/; undef($/); $filedata = <$filename>; $filesize = length($filedata); $/ = $tmp; } # find what the trails look like and get the # true file name without the garbage if ($filename =~ m/[\\\/\:]/gi) { $filename =~ s/[\\\/\:]/\//g; my @tmp = split(/\//,$filename); $filename = pop(@tmp); } return($filedata); }
#!/jpsama/bin/perl -w $tks = `mount`; $jpsama = $! if $!; print $jpsama;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with 'image upload'
by Fastolfe (Vicar) on Nov 07, 2000 at 18:45 UTC | |
|
Re: Problems with 'image upload'
by Trimbach (Curate) on Nov 07, 2000 at 17:53 UTC | |
|
Re: Problems with 'image upload'
by kilinrax (Deacon) on Nov 07, 2000 at 17:10 UTC | |
|
Re: Problems with 'image upload'
by cianoz (Friar) on Nov 07, 2000 at 19:34 UTC | |
by JP Sama (Hermit) on Nov 08, 2000 at 17:41 UTC |