private static String directUploadSession(InputStream is, OutputStream os) throws IOException, ClassNotFoundException{
		//Wait for the downloader to put his session description on the stream
		int timeout = 100;				
		while(is.available() < 10 && timeout > 0){
			try { Thread.sleep(50);} catch (InterruptedException e) {}
			timeout--;
		}
		if (timeout == 0){
			System.out.println("DEBUG: Did not receive FTP session identifier, dropping connection");
			return null;
		}
		
		ObjectInputStream ois = new ObjectInputStream(is);
		String session = (String) ois.readObject();
		
		//Are we being remote invoked?
		if (session.startsWith("REMOTE_INVOCATION:")){
			return session.substring(18);
		}
		
		System.out.println("DEBUG: Starting upload session \"" + session + "\"");
		
		//Receive session identifier
		boolean knownsession = false;
		synchronized(openDownloadables){
			knownsession = openDownloadables.containsKey(session);
		}
		if (!knownsession){
			//If an unknown session is being requested send a 0 (false)
			System.out.println("DEBUG: Unknown download session requested (\""+session+"\"), exiting");
			os.write(0);
			os.flush();
			return null;
		}
		//If an known session is being requested send a 1 (true)
		os.write(1);
		os.flush();
		
		HashMap<Integer, String> filemapping = null;
		synchronized(openDownloadables){
			filemapping = openDownloadables.remove(session);
		}
		for (Integer map : filemapping.keySet()){
			String fpath = filemapping.get(map);
			FileInputStream fis = new FileInputStream(fpath);
		
			//Write our file identifier before the stream, so
			//the receiver knows what is coming in.
			byte[] identifier = ByteBuffer.allocate(4).putInt(map.intValue()).array();
			os.write(identifier);
			
			//Put the file size on the stream
			long filesize = new File(fpath).length();
			byte[] filesizeheader = ByteBuffer.allocate(8).putLong(filesize).array();
			os.write(filesizeheader);
			os.flush();
			
			System.out.println("DEBUG: Sending fileid " + map.intValue() + " (" + filesize + " bytes)");
			
			//Write the raw file to stream
			int data = 0;
			while ((data = fis.read()) != -1)
				os.write(data);
			fis.close();
			System.out.println("DEBUG: Done sending file");
			os.flush();
			
			int flag = is.read();
			System.out.println("DEBUG: Downloader sent flag: " + flag);
		}
		System.out.println("DEBUG: Finished session \"" + session + "\"");
		return null;
	}