r_mehmed has asked for the wisdom of the Perl Monks concerning the following question:
As it is now, this would throw an error like:#!perl -wT use CGI; use CGI::Carp qw ( fatalsToBrowser ); use strict; use Fcntl qw ( :DEFAULT :flock ); use constant UPLOAD_DIR => "c:/some/path/Admin/images/"; my $q = new CGI; my $filename = $q->param('file'); my $fh = $q->upload('file'); $filename =~ s/[^\w.-]/_/g; if ($filename =~ /^(\w[\w.-]*)/) { $filename = $1; } else { error($q, "Invalid file name." ); } my $upload_dir = UPLOAD_DIR . $filename; sysopen(OUTPUT, $upload_dir, O_CREAT | O_RDWR | O_EXCL); my $buffer = ""; while (read($fh, $buffer, 16384)) { print OUTPUT $buffer; } close OUTPUT; print $q->header, $q->start_html("At long last"), $q->h1("done dude...doh"), $q->end_html;
or something like:Can't use an undefined value as a symbol reference at C:/some/path/aga +in.pl line 34.
Essentially i tried to follow the docs, made use of past posts here in <a href="www.perlmonks.org>perlmonks, with no apparent success though!!Error near ""binmode
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: file upload (again)
by tachyon (Chancellor) on Feb 08, 2003 at 11:38 UTC | |
|
Re: file upload (again)
by poj (Abbot) on Feb 08, 2003 at 11:36 UTC | |
|
Re: file upload (again)
by zentara (Cardinal) on Feb 08, 2003 at 14:02 UTC |