You can probably invoke a helper application on the server, sox appears to be helpful.
For example,
sox stat infile.wav outfile.wav
Converts infile.wav to outfile.wav, producing some stats on stdout (including the length). I don't know how to (obviously) do this without making an output file (you could of course output to /dev/null or a junk file).
Maybe another helper will do
Mark