Okay I think I'm a dorkis - but here goes - I have been searching for a way to upload Binnary stuff IE gifs and jpegs to my server via perl - here is the code that im using:
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 ( );
however, the image comes out bad i mean really bad - how can i tell perl to upload in binnary mode using the above?
thanks in advance!
- Scott
Wise men ask questions, only fools keep quite.
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 ( );
however, the image comes out bad i mean really bad - how can i tell perl to upload in binnary mode using the above?
thanks in advance!
- Scott
Wise men ask questions, only fools keep quite.