| 1 |
|
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>Embperl Tests - File-Upload</title> |
| 5 |
</head> |
| 6 |
[! |
| 7 |
use Data::Dumper ; |
| 8 |
!] |
| 9 |
<h1>Embperl Tests - File-Upload</h1> |
| 10 |
|
| •11 |
[+ do { $cgiok = $CGI::VERSION > 2.45; $cgi4 = $CGI::VERSION >= 4; @info = sort keys %{$fdat{-upload}} ; ($cgiok||$cgi4)?"@info":'Content-Disposition Content-Type' } +] |
| 12 |
Filename: [+ $cgiok?$fdat{upload}:'upload-filename' +]<br> |
| 13 |
Content-Type: [+ $cgiok?$fdat{-upload} -> {'Content-Type'}:'test/plain' +]<br> |
| 14 |
CGI-Version: [+ $CGI::VERSION +] |
| 15 |
cgiok [+ $cgiok +] |
| 16 |
filehandle: [+ ref $fdat{upload} +] |
| 17 |
Info: [+ join ("\n", map { "$_ = $fdat{-upload}{$_}" } sort keys %{$fdat{-upload}}) +] |
| 18 |
[- |
| 19 |
$no = 1 ; |
| 20 |
while ($size = read($fdat{upload}, $buffer, 2048)) |
| 21 |
{ |
| 22 |
$buf .= $buffer ; |
| 23 |
print OUT 'no: ', $no++, "\n" ; |
| 24 |
print OUT 'size: ', $size, "\n" ; |
| 25 |
} |
| 26 |
-] |
| 27 |
buflen: [+ length($buf) +] |
| 28 |
|
| 29 |
Your file has the content |
| 30 |
---------- |
| 31 |
[+ $buf +] |
| 32 |
---------- |
| 33 |
|
| 34 |
<hr> |
| 35 |
|
| 36 |
content: [+ $fdat{content} +] <br> |
| 37 |
|
| 38 |
multval: [+ join (';', split ("\t", $fdat{multval})) +] <br> |
| 39 |
|
| 40 |
single: [+ $fdat{single} +] <br> |
| 41 |
|
| 42 |
<br> |
| 43 |
|
| 44 |
[# |
| 45 |
eval 'use IO::Handle' ; |
| 46 |
$h = undef ; |
| 47 |
eval '$h = IO::Handle -> new_from_fd (fileno ($fdat{upload}), "r")' ; |
| 48 |
-] |
| 49 |
[+ if ($h) { @s = $h -> stat ; $s[7]} else { '8219' } +] |
| 50 |
#] |
| 51 |
<p><hr> |
| 52 |
|
| 53 |
<small>HTML::Embperl (c) 1997-1998 G.Richter</small> |
| 54 |
|
| 55 |
</body> |
| 56 |
</html> |