<html>
<head>
<title>Embperl Tests - File-Upload</title>
</head>
[!
use Data::Dumper ;
!]
<h1>Embperl Tests - File-Upload</h1>
[+ do { $cgiok = $CGI::VERSION > 2.45; $cgi4 = $CGI::VERSION >= 4; @info = sort keys %{$fdat{-upload}} ; ($cgiok||$cgi4)?"@info":'Content-Disposition Content-Type' } +]
Filename: [+ $cgiok?$fdat{upload}:'upload-filename' +]<br>
Content-Type: [+ $cgiok?$fdat{-upload} -> {'Content-Type'}:'test/plain' +]<br>
CGI-Version: [+ $CGI::VERSION +]
cgiok [+ $cgiok +]
filehandle: [+ ref $fdat{upload} +]
Info: [+ join ("\n", map { "$_ = $fdat{-upload}{$_}" } sort keys %{$fdat{-upload}}) +]
[-
$no = 1 ;
while ($size = read($fdat{upload}, $buffer, 2048))
{
$buf .= $buffer ;
print OUT 'no: ', $no++, "\n" ;
print OUT 'size: ', $size, "\n" ;
}
-]
buflen: [+ length($buf) +]
Your file has the content
----------
[+ $buf +]
----------
<hr>
content: [+ $fdat{content} +] <br>
multval: [+ join (';', split ("\t", $fdat{multval})) +] <br>
single: [+ $fdat{single} +] <br>
<br>
[#
eval 'use IO::Handle' ;
$h = undef ;
eval '$h = IO::Handle -> new_from_fd (fileno ($fdat{upload}), "r")' ;
-]
[+ if ($h) { @s = $h -> stat ; $s[7]} else { '8219' } +]
#]
<p><hr>
<small>HTML::Embperl (c) 1997-1998 G.Richter</small>
</body>
</html>