Dennis Daupert <[EMAIL PROTECTED]> wrote:
> I have gotten file upload working using Apache::Request for
> text files. But binary files seem to have other ideas :-)
>
> For example, uploading a word doc, I get a success message,
> but when I retrieve the doc after uploading it, and try to open it in
> Word 2000, I get the popup error message:
>
> "The document name or path is not valid... etc" [...]
>
> In case I have done something silly in my code, [...]
you may have done one silly thing :-)
> my $fh = $upload->fh;
> my @file = <$fh>;
here you slurp the lines of the text file into the @file array
> print WRITEFILE "@file";
and here you put the @file array into double-quotes. normal string
interpolation of an array is to join together the elements of the array,
separated by a *space*. this is not what you wanted to do.
for instance, this code:
@a=('a','b','c');
print "@a";
prints: "a b c" instead of "abc"
while:
@a=('a','b','c');
print @a;
prints: "abc"
so you should try:
print WRITEFILE @file; # without the quotes
instead and see if that works.
hth,
-dave