frnk has asked for the wisdom of the Perl Monks concerning the following question:
i have a problem with a quiet simple file-upload script.
Background: I've two websites both on the same server in different folders. I took the (working) script from one site with some small changes to use it also in the other one, but i cant get it to work.
Here ist the code:sub Upload { my $dst = shift; my $src = shift; my $dat +a; my $ext = $src; $ext =~ s/^.*\.//; $dst .= ".$ext"; open (DATEI,'>',$dst) or die 'Error processing file: ',$!; binmode $src; binmode DATEI; # --- Datei hochladen while(read $src,$data,640000) { print DATEI $data; } close DATEI; }
The result is a zero-byte file. The problem appears at binmode $src;. After this line $! contains 'Bad file number'.
I tried to comment out this line but then the error appears after calling read().
Any ideas???
Regards, Frank
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI-Upload / Bad File Number
by poj (Abbot) on Jul 16, 2016 at 13:02 UTC | |
|
Re: CGI-Upload / Bad File Number
by Laurent_R (Canon) on Jul 16, 2016 at 13:49 UTC | |
by frnk (Novice) on Jul 16, 2016 at 15:14 UTC | |
|
Re: CGI-Upload / Bad File Number
by frnk (Novice) on Jul 16, 2016 at 15:05 UTC | |
by poj (Abbot) on Jul 16, 2016 at 16:14 UTC | |
by frnk (Novice) on Jul 16, 2016 at 18:42 UTC | |
by poj (Abbot) on Jul 16, 2016 at 19:53 UTC | |
by frnk (Novice) on Jul 17, 2016 at 05:40 UTC | |
by Anonymous Monk on Jul 17, 2016 at 01:55 UTC | |
by frnk (Novice) on Jul 17, 2016 at 05:59 UTC | |
|