I'm working on a component that allows the user to upload up to 3
different files.  So I've created 3 FileReference objects to hold the
files, and so I can call the browse() method on them when a user
clicks the appropriate button.

Later I want to look at the properties of the FileReference objects,
but if I try to interrogate them in code I get a runtime exception if
the user hasn't selected a file yet.

I can't find a property of the FileReference object that will tell me
whether a file has been chosen or not.  I tried using:

if (myFileRef.name != null)

but that throws an exception as well (although the documentation seems
to suggest that this should work).  The only workaround I could find
was to wrap my statement in a try, with an empty catch (because I only
want to do something if a file has been selected).  But this seems
pretty ugly to me.

I'm quite a newbie, so there may be a much better way of doing this,
which would also get around the problem.

Any help that anyone could provide would be greatly appreciated.

Thanks,
Bob

Reply via email to