protected function uploadParts($filePath, $uploadUrl, $largeFileAuthToken)
    {
        $return = [];

        $minimum_part_size = 100 * (1000 * 1000);

        $local_file_size = filesize($filePath);
        $total_bytes_sent = 0;
        $bytes_sent_for_part = $minimum_part_size;
        $sha1_of_parts = [];
        $part_no = 1;
        $file_handle = fopen($filePath, 'r');

        while ($total_bytes_sent < $local_file_size) {

            // Determine the number of bytes to send based on the minimum part size
            if (($local_file_size - $total_bytes_sent) < $minimum_part_size) {
                $bytes_sent_for_part = ($local_file_size - $total_bytes_sent);
            }

            // Get a sha1 of the part we are going to send
            fseek($file_handle, $total_bytes_sent);
            $data_part = fread($file_handle, $bytes_sent_for_part);
            array_push($sha1_of_parts, sha1($data_part));
            fseek($file_handle, $total_bytes_sent);

            $response = $this->client->request('POST', $uploadUrl, [
                'headers' => [
                    'Authorization'                      => $largeFileAuthToken,
                    'Content-Length'                     => $bytes_sent_for_part,
                    'X-Bz-Part-Number'                   => $part_no,
                    'X-Bz-Content-Sha1'                  => $sha1_of_parts[$part_no - 1],
                ],
                'body' => $data_part,
            ]);

            $return[] = $response;

            // Prepare for the next iteration of the loop
            $part_no++;
            $total_bytes_sent = $bytes_sent_for_part + $total_bytes_sent;
        }

        fclose($file_handle);

        return $return;
    }
protected function uploadParts($filePath, $uploadUrl, $largeFileAuthToken)
    {
        $return = [];

        $minimum_part_size = 100 * (1000 * 1000);

        $local_file_size = filesize($filePath);
        $total_bytes_sent = 0;
        $bytes_sent_for_part = $minimum_part_size;
        $sha1_of_parts = [];
        $part_no = 1;
        $file_handle = fopen($filePath, 'r');

        while ($total_bytes_sent < $local_file_size) {

            // Determine the number of bytes to send based on the minimum part size
            if (($local_file_size - $total_bytes_sent) < $minimum_part_size) {
                $bytes_sent_for_part = ($local_file_size - $total_bytes_sent);
            }

            // Get a sha1 of the part we are going to send
            fseek($file_handle, $total_bytes_sent);
            $data_part = fread($file_handle, $bytes_sent_for_part);
            array_push($sha1_of_parts, sha1($data_part));
            fseek($file_handle, $total_bytes_sent);

            $response = $this->client->request('POST', $uploadUrl, [
                'headers' => [
                    'Authorization'                      => $largeFileAuthToken,
                    'Content-Length'                     => $bytes_sent_for_part,
                    'X-Bz-Part-Number'                   => $part_no,
                    'X-Bz-Content-Sha1'                  => $sha1_of_parts[$part_no - 1],
                ],
                'body' => $data_part,
            ]);

            $return[] = $response;

            // Prepare for the next iteration of the loop
            $part_no++;
            $total_bytes_sent = $bytes_sent_for_part + $total_bytes_sent;
        }

        fclose($file_handle);

        return $return;
    }
protected function uploadParts ( $ filePath , $ uploadUrl , $ largeFileAuthToken ) { $ return = [ ] ; $ minimum_part_size = 100 * ( 1000 * 1000 ) ; $ local_file_size = filesize ( $ filePath ) ; $ total_bytes_sent = 0 ; $ bytes_sent_for_part = $ minimum_part_size ; $ sha1_of_parts = [ ] ; $ part_no = 1 ; $ file_handle = fopen ( $ filePath , 'r' ) ; while ( $ total_bytes_sent < $ local_file_size ) { // Determine the number of bytes to send based on the minimum part size if ( ( $ local_file_size - $ total_bytes_sent ) < $ minimum_part_size ) { $ bytes_sent_for_part = ( $ local_file_size - $ total_bytes_sent ) ; } // Get a sha1 of the part we are going to send fseek ( $ file_handle , $ total_bytes_sent ) ; $ data_part = fread ( $ file_handle , $ bytes_sent_for_part ) ; array_push ( $ sha1_of_parts , sha1 ( $ data_part ) ) ; fseek ( $ file_handle , $ total_bytes_sent ) ; $ response = $ this -> client -> request ( 'POST' , $ uploadUrl , [ 'headers' => [ 'Authorization' => $ largeFileAuthToken , 'Content-Length' => $ bytes_sent_for_part , 'X-Bz-Part-Number' => $ part_no , 'X-Bz-Content-Sha1' => $ sha1_of_parts [ $ part_no - 1 ] , ] , 'body' => $ data_part , ] ) ; $ return [ ] = $ response ; // Prepare for the next iteration of the loop $ part_no ++ ; $ total_bytes_sent = $ bytes_sent_for_part + $ total_bytes_sent ; } fclose ( $ file_handle ) ; return $ return ; }
uploads the file as "parts" of 100MB each.

@param $filePath
@param $uploadUrl
@param $largeFileAuthToken

@return array
uploads the file as parts of 100MB each .