You can't access files on the client side, and on the server side you can only access files that are internal to Postgres (e.g. inside /data/postgres, or whatever path your Postgres uses for the database). And only super-users can use this function at all because it allows access to sensitive server files.
The easiest way to do this on the client side is to read the file into a client-side variable and then use a prepared statement. In Perl, something like this:
use DBI;
my $dbh = $dbi->connect(...);
my $photo;
open(PHOTO, "/home/flags");
binmode PHOTO;
while (<PHOTO>) {
$photo .= $_;
}
my $sth = $dbh->prepare("insert into flags(country_code, flag) values(?, ?)");
$sth->execute('AD', $photo);