code: public void addFilePart(final String fieldName, final InputStream stream, final String fileName, final String contentType)
          throws IOException
      {
          writer.append("--").append(boundary).append(LINE_FEED);
  
          writer.append("Content-Disposition: form-data; name=\"").append(fieldName).append("\"");
          if (fileName != null) {
              writer.append("; filename=\"").append(fileName).append("\"");
          }
          writer.append(LINE_FEED);
  
          writer.append("Content-Type: ").append(contentType).append(LINE_FEED);
          writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED);
          writer.append(LINE_FEED);
          writer.flush();
  
          OsUtils.copyStreams(stream, outputStream);
  
          outputStream.flush();
  
          writer.append(LINE_FEED);
          writer.flush();
      }
docs: Adds a upload file section to the request
  @param fieldName name attribute in &lt;input type="file" name="..." /&gt;
  @param stream input stream of data to upload
  @param fileName name of file represented by this input stream
  @param contentType content type of data
  @throws IOException if problems