Once you go to BINMODE on a file handle, a record separator makes no sense.
A more typical way to read a large binary file would be statements like this:
binmode INBIN;
my $n_bytes = read(INBIN, $buff, $BUFSIZE);
That's a request to read $BUFSIZE bytes from INBIN into $buff. $n_bytes is number of bytes actually read from INBIN.
I've never wound up reading a binary file in a single shot into a Perl variable because my bin files are not appropriate for that (so big they need to be read in chunks). However, I guess this would work (untested):
use MIME::Base64;
use strict;
use warnings;
my $upload_dir = 'uploaded_files';
my $file_name = 'image.jpg';
### Open the image to convert to base64
open (IMAGE, '<', "$upload_dir/$file_name") or die "$!";
binmode IMAGE;
my $binary = <IMAGE>;
my $base64 = encode_base64(pack('B*', $binary));
print "base64 = $base64\n";