entry.put("size", tmpName.getLength()); entry.put("tmp_name", tmpName.getTail());
}  addFormValue(entry, "size" + index, new LongValue(tmpName.getLength()), null, addSlashesToValues);  addFormValue(entry, "tmp_name" + index, new StringValueImpl(tmpName.getTail()), null, addSlashesToValues);
  private static void readMultipartStream(Env env,                                          MultipartStream ms,                                          ArrayValue post,                                          ArrayValue files,                                          boolean addSlashesToValues)    throws IOException  {    ReadStream is;    while ((is = ms.openRead()) != null) {      String attr = (String) ms.getAttribute("content-disposition");      if (attr == null || ! attr.startsWith("form-data")) {        // XXX: is this an error?        continue;      }      String name = getAttribute(attr, "name");      String filename = getAttribute(attr, "filename");      if (filename == null) {        StringBuilder value = new StringBuilder();        int ch;        while ((ch = is.read()) >= 0) {          value.append((char) ch);        }        addFormValue(post, name, new StringValueImpl(value.toString()), null, addSlashesToValues);      }      else {        Path tmpName = env.getUploadDirectory().createTempFile("php", "tmp");        env.addRemovePath(tmpName);        WriteStream os = tmpName.openWrite();        try {          os.writeStream(is);        } finally {          os.close();        }        ArrayValue entry = new ArrayValueImpl();        entry.put("name", filename);        String mimeType = getAttribute(attr, "mime-type");        if (mimeType != null)          entry.put("type", mimeType);        entry.put("size", tmpName.getLength());        entry.put("tmp_name", tmpName.getTail());        // XXX: error        addFormValue(files, name, entry, null, addSlashesToValues);      }    }  }