The easiest way I've found for importing files into postgresql is to write a little importer tool to rip apart the input file and put it into postgresql dump format. to see the dump format of a table, enter pg_dump <dbname> -t <tablename>. If there's no rows, you won't see much, so you might want to insert a single row's worth of fake data by hand just to see what it looks like.
Here's the selected bits from my pg_dump of a test table in my box:
COPY "test" FROM stdin;
smarlowe 1 10
leif 2 0
\N 3 22
.
The rest of the dump is unimportant for our purposes. This is the standard dump format for data. It is a tab delimitted file with \N for all the NULL fields.
What format is your flat file in? if it's already tab delimitted, just write a php script to read each line and replace empty fields (i.e. one's with ONLY a tab) into a tab followed by a \N and then add the copy from stdin line and a . at the end. you can then import the file by typing in
psql databasename -e <import_file.txt
assuming you've a table built to hold the data.