I'm using the following code to have users upload files to a directory on my site - every time I test though the process adds about 20-30 bits of data to the file, causing havoc with it - like turning this:
(size: 7951 bits)
into this:
(size: 7981 bits)
Any ideas? - Here's the code:
#!/usr/bin/perl
use CGI;
$upload_dir = "/uploads";
$query = new CGI;
$filename = $query->param('upload_file');
$filename =~ s/.*[\/\\](.*)/$1/;
$upload_filehandle = $query->upload("upload_file");
open UPLOADFILE, ">$upload_dir/$filename";
while ( <$upload_filehandle> )
{
print UPLOADFILE;
}
close UPLOADFILE;
print $query->header ( );
(size: 7951 bits)
into this:
(size: 7981 bits)
Any ideas? - Here's the code:
#!/usr/bin/perl
use CGI;
$upload_dir = "/uploads";
$query = new CGI;
$filename = $query->param('upload_file');
$filename =~ s/.*[\/\\](.*)/$1/;
$upload_filehandle = $query->upload("upload_file");
open UPLOADFILE, ">$upload_dir/$filename";
while ( <$upload_filehandle> )
{
print UPLOADFILE;
}
close UPLOADFILE;
print $query->header ( );