Thread Apache2 und multipart/form-data (22 answers)
Opened by Froschpopo at 2009-08-19 17:03

Froschpopo
 2009-08-19 18:11
#124445 #124445
User since
2003-08-15
2653 Artikel
BenutzerIn
[default_avatar]
$CGI::POST_MAX = 1024 * 100;
$CGI::DISABLE_UPLOADS = 0;

Ich habe hier mal ein winziges Testscript gebaut:

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
23
24
#/usr/bin/perl

use warnings;
use strict;
use CGI;

$CGI::POST_MAX = 1024 * 100;
$CGI::DISABLE_UPLOADS = 0;

my $cgi = new CGI;

my $fh = $cgi->upload('file');
my $fn = $cgi->param('file');

print $cgi->header;
print "Dateiname: ", $fn;   # Zeigt den Dateiname korrekt an!!!!

my $bin_data = 0;
for (<$fh>) {
   $bin_data .= $_;
}

my $size = length($bin_data);
print "Filesize: ", $size;     # 0 <--------------------------------


Das HTML sieht so aus:
Code: (dl )
1
2
3
4
<form action="/cgi-bin/test.pl" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit">
</form>

Last edited: 2009-08-19 18:15:36 +0200 (CEST)

View full thread Apache2 und multipart/form-data