in reply to CGI-Upload / Bad File Number
Hi,
thanks for your suggestions.
'$src' contains the name of the file to be uploaded (i.e. '123.jpg'). The value comes from a html-formular.
I want to upload a file, so - as far as i know - i don't have to open it and there is no handle. But i have to admit, that i don't really aunderstand how uploading-process works.
As alredy mentioned, i use a simelar code in another script, where it works fine. Below is the working function (comments are translated) for comparation...
if($file=~/[\w _\.\-\(\)\+]+\.jpg/i) { # --- Zieldateiennamen erstelle und Datei öffnen => engl.: c +reate destination-file-name and open $sname = time.'.'.$ENV{'REMOTE_ADDR'}.' - '.$ueberschrift.' - '. +$unterschrift.' - '.$file; $sname =~ s/ä/ae/g; $sname =~ s/Ä/Ae/g; $sname =~ s/ö/oe/g; $sname =~ s/Ö/Oe/g; $sname =~ s/ü/ue/g; $sname =~ s/Ü/Ue/g; $sname =~ s/ß/ss/g; $fname = '../Content/Gaestebuch/'.$sname; open DAT,'>'.$fname or die 'Error processing file: ',$!; # --- Dateien in den Binaer-Modus schalten => engl.: switc +h to bin-mode binmode $file; binmode DAT; # --- Datei hochladen => engl.: Upload my $data; while(read $file,$data,640000) { print DAT $data; } close DAT; }
As you see, also here '$file' (= '$src' in the other function) is not a handle.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI-Upload / Bad File Number
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 | |
by Anonymous Monk on Jul 17, 2016 at 08:26 UTC | |
|