Make file sending work both on client and server side