binmode(TESTFILE)
-----Original Message-----Hello,
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Shariman Azeze
Sent: Thursday, June 28, 2001 9:04 AM
To: [EMAIL PROTECTED]
Subject: Binary File Upload ProblemI'm trying to create a File Upload script which recieve the file via HTML form. However, when ever the file is a binary file (i.e. image, compiled script) the upload will always produced a corrupted file.
FYI, I'm using ActivePerl Build 519 and running the script on a WinNT Server. The sample script that I'm using is as shown below:
# Configurable Option
Can someone share with me a working example of file upload script using ActivePerl and run on a WinNT environment?
$SAVE_DIRECTORY = "d:\\InetPub\\ftproot\\Temporary"; # Define where uploaded file should go (temp. directory)# Processing Info. Recieved from the Form
$| = 1;
chop $SAVE_DIRECTORY if ($SAVE_DIRECTORY =~ /\/$/);
use CGI qw(:standard); # Uses CGI library to process the info
$query = new CGI;$run_file = $query->param(run_file);
binmode($run_file);
binmode(STDOUT);open (TESTFILE,">$SAVE_DIRECTORY\\try2.gif");
while ($Bytes = read($run_file,$Buffer,1024))
{
$BytesRead += $Bytes;
print TESTFILE $Buffer;
}
close(TESTFILE);
exit;Thanks in advance...
-SHARIMAN AZEZE-
[EMAIL PROTECTED]
