src/Thybag/SharePointAPI.php
public function addAttachment ($list_name, $list_item_id, $file_name) {
		// base64 encode file
		$attachment = base64_encode(file_get_contents($file_name));

		// Wrap in CAML
		$CAML = '
		<AddAttachment xmlns="http://schemas.microsoft.com/sharepoint/soap/">
			<listName>' . $list_name . '</listName>
			<listItemID>' . $list_item_id . '</listItemID>
			<fileName>' . $file_name . '</fileName>
			<attachment>' . $attachment . '</attachment>
		</AddAttachment>';

		$xmlvar = new \SoapVar($CAML, XSD_ANYXML);

		// Attempt to run operation
		try {
			$this->soapClient->AddAttachment($xmlvar);
		} catch (\SoapFault $fault) {
			$this->onError($fault);
		}

		// Return true on success
		return true;
	}
public function addAttachment ($list_name, $list_item_id, $file_name) {
		// base64 encode file
		$attachment = base64_encode(file_get_contents($file_name));

		// Wrap in CAML
		$CAML = '
		<AddAttachment xmlns="http://schemas.microsoft.com/sharepoint/soap/">
			<listName>' . $list_name . '</listName>
			<listItemID>' . $list_item_id . '</listItemID>
			<fileName>' . $file_name . '</fileName>
			<attachment>' . $attachment . '</attachment>
		</AddAttachment>';

		$xmlvar = new \SoapVar($CAML, XSD_ANYXML);

		// Attempt to run operation
		try {
			$this->soapClient->AddAttachment($xmlvar);
		} catch (\SoapFault $fault) {
			$this->onError($fault);
		}

		// Return true on success
		return true;
	}
public function addAttachment ( $ list_name , $ list_item_id , $ file_name ) { // base64 encode file $ attachment = base64_encode ( file_get_contents ( $ file_name ) ) ; // Wrap in CAML $ CAML = '
		<AddAttachment xmlns="http://schemas.microsoft.com/sharepoint/soap/">
			<listName>' . $ list_name . '</listName>
			<listItemID>' . $ list_item_id . '</listItemID>
			<fileName>' . $ file_name . '</fileName>
			<attachment>' . $ attachment . '</attachment>
		</AddAttachment>' ; $ xmlvar = new \ SoapVar ( $ CAML , XSD_ANYXML ) ; // Attempt to run operation try { $ this -> soapClient -> AddAttachment ( $ xmlvar ) ; } catch ( \ SoapFault $ fault ) { $ this -> onError ( $ fault ) ; } // Return true on success return true ; }
addAttachment
Add an attachment to a SharePoint List

@param $list_name Name of list
@param $list_item_id ID of record to attach attachment to
@param $file_name path of file to attach
@return Array
addAttachment Add an attachment to a SharePoint List