At the risk of being a heavy hypocrite, waltzing into Coding Help and saying 'solve this please' without saying why you need it is generally a bad idea because you might already be doing something wrong.
Brian is right; if your loading a file on the CLIENT-SIDE takes long enough to need a progress bar, you've already forgeted something up.
THEREFORE, I'm assuming that you're transferring files from a client to a server or vice versa. In which case you will need to read the entire file anyway, so just read the whole file into a storage object and then you have the line count inherently:
%file = new FileObject(%path);
%store = new SimObject();
while(!%file.isEOF())
%store.line[-1+%store.lines++] = %file.readLine();
echo("Number of lines in "@fileName(%path)@" is "@%store.lines);