Thread Datei über Perl einlesen und an Browser senden (3 answers)
Opened by dude at 2009-04-07 13:38

Gast dude
 2009-04-07 14:38
#120351 #120351
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
    ### read file and send
    my $file_size = -s qq{./.tmp/$dir/$file};

    print CGI::header({
        'content-type'        => 'application/zip',
        'content-length'      => $file_size,
        'content-disposition' => qq{attachment; filename=$file}
    });
    
    open my $ZIP, qq{./.tmp/$dir/$file} or do {
            $self->_generate_response({
                code        => 500,
                message     => qq{file $file not found: $!},
            });
            
            return;        
    };
    my $buffer;
        while(read $ZIP,$buffer,16384) {
                print $buffer;
        }
    close $ZIP;

Problem gelöst.

View full thread Datei über Perl einlesen und an Browser senden