public static function processFileUpload($file, $mime) {
    if (!$file) return array();
    if (substr($file, 0, 1) != '@') {
      $file = '@' . $file;
    }

    // This is a standard file upload with curl.
    $params = array('postBody' => array('file' => $file));
    if ($mime) {
      $params['content-type'] = $mime;
    }

    return $params;
  }