CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
MIME Types and Uploads Fields

 



filmo
Deleted

Nov 29, 2000, 4:44 PM

Post #1 of 1 (893 views)
MIME Types and Uploads Fields Can't Post

I've created a perl script that uploads files to the server. (Microsoft Word files specifically). However, it seems that many of them end up garbled and open in MS-Word as crap.(Some text body plus lots of control characters, etc.) I'm at a loss to understand why some upload correctly and others tend to get messed up in some way.

Here's the code I'm using.
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

foreach $key (keys %docPRFD)
{
$file = param($key);
$sendto = $base_path . $finishedDIR . $dailyDIR . $proofDIR . $docPRFD{$key};
open(OUT, ">$sendto") or Error('File Access Error',"An error occurred when opening the $key ($sendto): $!.");
$flen = 0;
while (read($file, $i, 1024))
{ print OUT $i;
$flen += 1024;
if ($flen > 512000) { close(OUT); Error('Upload Error',"File is too large! $file ($sendto): $!.");}
}
close(OUT);
$msg .= "The proofread version of $docPRFD{$key} has been received.</br>";
$height += 8;
}</pre><HR></BLOCKQUOTE>

The keys of the %docPRFD hash contains the file names passed from the upload field form and the values contains the "proper name" to write the file as.

Any thoughts on why some are uploading funky and others are just fine?

Thanks

Phil.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives