private void Upload(ByteBuffer packet) throws RuntimeException, IOException{
		// given packet w/no header!
		// (for uploading request c->s) [header | filesize(8) | filename(?)]
		// (for upload acknowledgement s->c) [header | already exists (1) | file id (4)]
		
		// parse the req
		if (packet.capacity() < 4)
			throw new RuntimeException(
					"filename not correctly uploaded");
		long buf_size = packet.getLong(0);
		String buf_name = "";
		for (int i = 0; i < buf.capacity(); i++){
			if (buf.get(8 +i) == '\0')
				break;
			buf_name += (char)buf.get(8 + i);
		}
		if (buf_name.length() == 0)
			throw new RuntimeException(
					"filename not correctly uploaded");
		
		int id = buf_name.hashCode() + (int)buf_size;
		boolean add = true;
		for (ClientObj c : clients)
			if (c.hasFile(id)) // Check for duplicate id's, which would be problematic
				add = false;
		byte exists =  0;
		if (add)
			client.addUpload(new ServerFile(buf_name, buf_size, id));
		else {
			for (ServerFile f : totalFiles().keySet())
				if (f.id() == id)
					client.addUpload(f);
			exists = 1;
		}
		System.out.println(client.getAddress() + ": Correctly processed upload req for " + buf_name 
				+ " with size " + buf_size + " bytes and id " + id);
		
		//construct/send response
		buf = Utility.addHeader(3, 5, client.getId());
		buf.put(Constants.HEADER_LEN, exists);
		buf.putInt(Constants.HEADER_LEN + 1, id);
		byte[] sendData = buf.array();
		
		// send response
		out.write(sendData);
		out.flush();
	}