WCM - Das österreichische Computer Magazin Forenübersicht
 

Zurück   WCM Forum > Rat & Tat > Programmierung

Programmierung Rat & Tat für Programmierer

Microsoft KARRIERECAMPUS

 
 
Themen-Optionen Ansicht
Alt 06.05.2003, 03:59   #1
werner2k
Newbie
 
Registriert seit: 05.11.2001
Alter: 65
Beiträge: 4


Frage Perl-Downloadscript

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!!
werner2k ist offline   Mit Zitat antworten
 


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.

Gehe zu


Alle Zeitangaben in WEZ +2. Es ist jetzt 20:50 Uhr.


Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Forum SEO by Zoints
© 2009 FSL Verlag