public function Upload($imgBits, $fileName, $mimeType, $objAttachable)
    {
        $this->serviceContext->IppConfiguration->Logger->RequestLog->Log(TraceLevel::Info, "Called Method Upload.");

        // Validate parameter
        if (!$imgBits || !$mimeType || !$fileName) {
            $this->serviceContext->IppConfiguration->Logger->RequestLog->Log(TraceLevel::Error, "Argument Null Exception");
            throw new IdsException('Argument Null Exception');
        }
        // Builds resource Uri
        $urlResource = "upload";
        $uri = implode(CoreConstants::SLASH_CHAR, array('company', $this->serviceContext->realmId, $urlResource));

        $boundaryString = md5(time());

        $MetaData = $this->executeObjectSerializer($objAttachable, $urlResource);

        $desiredIdentifier = '0';
        $newline = "\r\n";
        $dataMultipart = '';
        $dataMultipart .= '--' . $boundaryString . $newline;
        $dataMultipart .= "Content-Disposition: form-data; name=\"file_metadata_{$desiredIdentifier}\"" . $newline;
        $dataMultipart .= "Content-Type: " . CoreConstants::CONTENTTYPE_APPLICATIONXML . '; charset=UTF-8' . $newline;
        $dataMultipart .= 'Content-Transfer-Encoding: 8bit' . $newline . $newline;
        $dataMultipart .= $MetaData;
        $dataMultipart .= '--' . $boundaryString . $newline;
        $dataMultipart .= "Content-Disposition: form-data; name=\"file_content_{$desiredIdentifier}\"; filename=\"{$fileName}\"" . $newline;
        $dataMultipart .= "Content-Type: {$mimeType}" . $newline;
        $dataMultipart .= 'Content-Transfer-Encoding: base64' . $newline . $newline;
        $dataMultipart .= chunk_split(base64_encode($imgBits)) . $newline;
        $dataMultipart .= "--" . $boundaryString . "--" . $newline . $newline; // finish with two eol's!!

        return $this->sendRequestParseResponseBodyAndHandleHttpError(null, $uri, $dataMultipart, DataService::UPLOAD, $boundaryString);
    }
public function Upload($imgBits, $fileName, $mimeType, $objAttachable)
    {
        $this->serviceContext->IppConfiguration->Logger->RequestLog->Log(TraceLevel::Info, "Called Method Upload.");

        // Validate parameter
        if (!$imgBits || !$mimeType || !$fileName) {
            $this->serviceContext->IppConfiguration->Logger->RequestLog->Log(TraceLevel::Error, "Argument Null Exception");
            throw new IdsException('Argument Null Exception');
        }
        // Builds resource Uri
        $urlResource = "upload";
        $uri = implode(CoreConstants::SLASH_CHAR, array('company', $this->serviceContext->realmId, $urlResource));

        $boundaryString = md5(time());

        $MetaData = $this->executeObjectSerializer($objAttachable, $urlResource);

        $desiredIdentifier = '0';
        $newline = "\r\n";
        $dataMultipart = '';
        $dataMultipart .= '--' . $boundaryString . $newline;
        $dataMultipart .= "Content-Disposition: form-data; name=\"file_metadata_{$desiredIdentifier}\"" . $newline;
        $dataMultipart .= "Content-Type: " . CoreConstants::CONTENTTYPE_APPLICATIONXML . '; charset=UTF-8' . $newline;
        $dataMultipart .= 'Content-Transfer-Encoding: 8bit' . $newline . $newline;
        $dataMultipart .= $MetaData;
        $dataMultipart .= '--' . $boundaryString . $newline;
        $dataMultipart .= "Content-Disposition: form-data; name=\"file_content_{$desiredIdentifier}\"; filename=\"{$fileName}\"" . $newline;
        $dataMultipart .= "Content-Type: {$mimeType}" . $newline;
        $dataMultipart .= 'Content-Transfer-Encoding: base64' . $newline . $newline;
        $dataMultipart .= chunk_split(base64_encode($imgBits)) . $newline;
        $dataMultipart .= "--" . $boundaryString . "--" . $newline . $newline; // finish with two eol's!!

        return $this->sendRequestParseResponseBodyAndHandleHttpError(null, $uri, $dataMultipart, DataService::UPLOAD, $boundaryString);
    }
public function Upload ( $ imgBits , $ fileName , $ mimeType , $ objAttachable ) { $ this -> serviceContext -> IppConfiguration -> Logger -> RequestLog -> Log ( TraceLevel :: Info , "Called Method Upload." ) ; // Validate parameter if ( ! $ imgBits || ! $ mimeType || ! $ fileName ) { $ this -> serviceContext -> IppConfiguration -> Logger -> RequestLog -> Log ( TraceLevel :: Error , "Argument Null Exception" ) ; throw new IdsException ( 'Argument Null Exception' ) ; } // Builds resource Uri $ urlResource = "upload" ; $ uri = implode ( CoreConstants :: SLASH_CHAR , array ( 'company' , $ this -> serviceContext -> realmId , $ urlResource ) ) ; $ boundaryString = md5 ( time ( ) ) ; $ MetaData = $ this -> executeObjectSerializer ( $ objAttachable , $ urlResource ) ; $ desiredIdentifier = '0' ; $ newline = "\r\n" ; $ dataMultipart = '' ; $ dataMultipart .= '--' . $ boundaryString . $ newline ; $ dataMultipart .= "Content-Disposition: form-data; name=\"file_metadata_{$desiredIdentifier}\"" . $ newline ; $ dataMultipart .= "Content-Type: " . CoreConstants :: CONTENTTYPE_APPLICATIONXML . '; charset=UTF-8' . $ newline ; $ dataMultipart .= 'Content-Transfer-Encoding: 8bit' . $ newline . $ newline ; $ dataMultipart .= $ MetaData ; $ dataMultipart .= '--' . $ boundaryString . $ newline ; $ dataMultipart .= "Content-Disposition: form-data; name=\"file_content_{$desiredIdentifier}\"; filename=\"{$fileName}\"" . $ newline ; $ dataMultipart .= "Content-Type: {$mimeType}" . $ newline ; $ dataMultipart .= 'Content-Transfer-Encoding: base64' . $ newline . $ newline ; $ dataMultipart .= chunk_split ( base64_encode ( $ imgBits ) ) . $ newline ; $ dataMultipart .= "--" . $ boundaryString . "--" . $ newline . $ newline ; // finish with two eol's!! return $ this -> sendRequestParseResponseBodyAndHandleHttpError ( null , $ uri , $ dataMultipart , DataService :: UPLOAD , $ boundaryString ) ; }
Uploads an attachment to an Entity on QuickBooks Online. For security reason, text file is not supported for uploading.

@param string $bits                        Encoded Base64 bytes for the attachment
@param string $fileName                    Filename to use for this file
@param string $mimeType                    MIME type to send in the HTTP Headers
@param IPPAttachable $objAttachable        Entity including the attachment, it can be invoice, bill, etc
@return array                              Returns an array of entities fulfilling the query.
@throws IdsException
Uploads an attachment to an Entity on QuickBooks Online . For security reason text file is not supported for uploading .