in reply to Short read error?

Most likely the Short Read error is thrown because you did not read the content data that was uploaded. Subsequently the webserver tries to read a command but gets data from its incoming stream.
$file = $query->param('fileID')
This will get you the filename that the HTTP client suggested, not a handle to the input stream. Therefore the "read($file,$buffer,1024)" command fails and not all of the incoming data stream is read.
my $fh = $query->upload('fileID');
Gets you a proper input filehandle, then use read($fh,$buffer,1024) as per your code.

I would recommend to also set binmode($fh) as well as on the output file so that you can safely process non-text files.