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.
In reply to Re: CGI-Upload / Bad File Number
by frnk
in thread CGI-Upload / Bad File Number
by frnk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |