original_string: public function upload($array)
  	{
  		$array['action'] = 'upload';
  		$array['format'] = 'php';
  
  		// Construct multipart body: https://www.mediawiki.org/wiki/API:Upload#Sample_Raw_Upload
  		$boundary = '---Wikimate-' . md5(microtime());
  		$body = '';
  		foreach ($array as $fieldName => $fieldData) {
  			$body .= "--{$boundary}\r\n";
  			$body .= 'Content-Disposition: form-data; name="' . $fieldName . '"';
  			// Process the (binary) file
  			if ($fieldName == 'file') {
  				$body .= '; filename="' . $array['filename'] . '"' . "\r\n";
  				$body .= "Content-Type: application/octet-stream; charset=UTF-8\r\n";
  				$body .= "Content-Transfer-Encoding: binary\r\n";
  			// Process text parameters
  			} else {
  				$body .= "\r\n";
  				$body .= "Content-Type: text/plain; charset=UTF-8\r\n";
  				$body .= "Content-Transfer-Encoding: 8bit\r\n";
  			}
  			$body .= "\r\n{$fieldData}\r\n";
  		}
  		$body .= "--{$boundary}--\r\n";
  
  		// Construct multipart headers
  		$headers = array(
  			'Content-Type' => "multipart/form-data; boundary={$boundary}",
  			'Content-Length' => strlen($body),
  		);
  
  		$apiResult = $this->session->post($this->api, $headers, $body);
  
  		return unserialize($apiResult->body);
  	}
code: public function upload($array)
  	{
  		$array['action'] = 'upload';
  		$array['format'] = 'php';
  
  		// Construct multipart body: https://www.mediawiki.org/wiki/API:Upload#Sample_Raw_Upload
  		$boundary = '---Wikimate-' . md5(microtime());
  		$body = '';
  		foreach ($array as $fieldName => $fieldData) {
  			$body .= "--{$boundary}\r\n";
  			$body .= 'Content-Disposition: form-data; name="' . $fieldName . '"';
  			// Process the (binary) file
  			if ($fieldName == 'file') {
  				$body .= '; filename="' . $array['filename'] . '"' . "\r\n";
  				$body .= "Content-Type: application/octet-stream; charset=UTF-8\r\n";
  				$body .= "Content-Transfer-Encoding: binary\r\n";
  			// Process text parameters
  			} else {
  				$body .= "\r\n";
  				$body .= "Content-Type: text/plain; charset=UTF-8\r\n";
  				$body .= "Content-Transfer-Encoding: 8bit\r\n";
  			}
  			$body .= "\r\n{$fieldData}\r\n";
  		}
  		$body .= "--{$boundary}--\r\n";
  
  		// Construct multipart headers
  		$headers = array(
  			'Content-Type' => "multipart/form-data; boundary={$boundary}",
  			'Content-Length' => strlen($body),
  		);
  
  		$apiResult = $this->session->post($this->api, $headers, $body);
  
  		return unserialize($apiResult->body);
  	}
code_tokens: public function upload ( $ array ) { $ array [ 'action' ] = 'upload' ; $ array [ 'format' ] = 'php' ; // Construct multipart body: https://www.mediawiki.org/wiki/API:Upload#Sample_Raw_Upload $ boundary = '---Wikimate-' . md5 ( microtime ( ) ) ; $ body = '' ; foreach ( $ array as $ fieldName => $ fieldData ) { $ body .= "--{$boundary}\r\n" ; $ body .= 'Content-Disposition: form-data; name="' . $ fieldName . '"' ; // Process the (binary) file if ( $ fieldName == 'file' ) { $ body .= '; filename="' . $ array [ 'filename' ] . '"' . "\r\n" ; $ body .= "Content-Type: application/octet-stream; charset=UTF-8\r\n" ; $ body .= "Content-Transfer-Encoding: binary\r\n" ; // Process text parameters } else { $ body .= "\r\n" ; $ body .= "Content-Type: text/plain; charset=UTF-8\r\n" ; $ body .= "Content-Transfer-Encoding: 8bit\r\n" ; } $ body .= "\r\n{$fieldData}\r\n" ; } $ body .= "--{$boundary}--\r\n" ; // Construct multipart headers $ headers = array ( 'Content-Type' => "multipart/form-data; boundary={$boundary}" , 'Content-Length' => strlen ( $ body ) , ) ; $ apiResult = $ this -> session -> post ( $ this -> api , $ headers , $ body ) ; return unserialize ( $ apiResult -> body ) ; }
docstring: Uploads a file to the wiki API.
  
  @param   array    $array  Array of details to be used in the upload
  @return  array            Unserialized php output from the wiki API
docstring_tokens: Uploads a file to the wiki API .