![]() |
![]() |
|
![]() |
![]() |
|
Programmierung Rat & Tat für Programmierer |
![]() |
|
Themen-Optionen | Ansicht |
|
![]() |
#1 |
Newbie
![]() Registriert seit: 05.11.2001
Alter: 65
Beiträge: 4
|
![]() Für eine Webanwendung habe ich eine Kette von Perl-Scripts geschrieben, unter anderm den folgenden Code für das Download von Dateien:
use strict; use common; use Mail::POP3Client; use MIME::Parser; use configwm; use CGI; use nswmauth; #obtain the FORM information that has been passed by using #the param() method of the cgi object. my $query=new CGI; my $nswmc=new common; my $nswmau = new nswmauth; my $loginname = $query->param("loginname"); my $pkey = $query->cookie(-name=>'PKEY'); my $password = $query->param("password"); # encrypted password !!! my $POPserver = $query->param("POPserver"); my $msgid = $query->param("id"); my $cache = $query->param("cache"); my $browser = $ENV{'HTTP_USER_AGENT'}; $|=1; # authenticate for download if ($nswmau->isAuthOK($loginname,$nswmc->decryptit($password,$query->cookie("PKEY")),$POPserver)==0) { print "</HEAD><BODY>"; print "<font size=+1>$POPserver: $loginname, $conf::incorrectlogin"; exit; } my $attch = $query->param("file"); my $mimetype=$nswmc->mimetype($attch); # do the download print "Content-type: $mimetype\n\n"; print "Content-disposition: attachment; filename=$attch"; print "\r\n" if (!$conf::modperl); open(ATTCH, "<$conf::temppath/$attch"); binmode ATTCH; while(<ATTCH>) { print $_; } close(ATTCH); exit; Er funktioniert recht gut - nur erscheint im "Save-as"-Fenster des Browsers (egal ob Opera oder IE) als Dateiname immer der Name des aufgerufenen CGI-Files (gespeichert wird allerdings die korrekte Datei). Weiss jemand Rat?? Danke im Voraus!! |
![]() |
![]() |
![]() |
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
|
|