Zend/Gdata/Docs.php
public function uploadFile($fileLocation, $title = null, $mimeType = null,
        $uri = null
    )
    {
        // Set the URI to which the file will be uploaded.
        if ($uri === null) {
            $uri = $this->_defaultPostUri;
        }

        // Create the media source which describes the file.
        $fs = $this->newMediaFileSource($fileLocation);
        if ($title !== null) {
            $slugHeader = $title;
        } else {
            $slugHeader = $fileLocation;
        }

        // Set the slug header to tell the Google Documents server what the
        // title of the document should be and what the file extension was
        // for the original file.
        $fs->setSlug($slugHeader);

        // Set the mime type of the data.
        if ($mimeType === null) {
          $filenameParts = explode('.', $fileLocation);
          $fileExtension = end($filenameParts);
          $mimeType = self::lookupMimeType($fileExtension);
        }

        // Set the mime type for the upload request.
        $fs->setContentType($mimeType);

        // Send the data to the server.
        return $this->insertDocument($fs, $uri);
    }
public function uploadFile($fileLocation, $title = null, $mimeType = null,
        $uri = null
    )
    {
        // Set the URI to which the file will be uploaded.
        if ($uri === null) {
            $uri = $this->_defaultPostUri;
        }

        // Create the media source which describes the file.
        $fs = $this->newMediaFileSource($fileLocation);
        if ($title !== null) {
            $slugHeader = $title;
        } else {
            $slugHeader = $fileLocation;
        }

        // Set the slug header to tell the Google Documents server what the
        // title of the document should be and what the file extension was
        // for the original file.
        $fs->setSlug($slugHeader);

        // Set the mime type of the data.
        if ($mimeType === null) {
          $filenameParts = explode('.', $fileLocation);
          $fileExtension = end($filenameParts);
          $mimeType = self::lookupMimeType($fileExtension);
        }

        // Set the mime type for the upload request.
        $fs->setContentType($mimeType);

        // Send the data to the server.
        return $this->insertDocument($fs, $uri);
    }
public function uploadFile ( $ fileLocation , $ title = null , $ mimeType = null , $ uri = null ) { // Set the URI to which the file will be uploaded. if ( $ uri === null ) { $ uri = $ this -> _defaultPostUri ; } // Create the media source which describes the file. $ fs = $ this -> newMediaFileSource ( $ fileLocation ) ; if ( $ title !== null ) { $ slugHeader = $ title ; } else { $ slugHeader = $ fileLocation ; } // Set the slug header to tell the Google Documents server what the // title of the document should be and what the file extension was // for the original file. $ fs -> setSlug ( $ slugHeader ) ; // Set the mime type of the data. if ( $ mimeType === null ) { $ filenameParts = explode ( '.' , $ fileLocation ) ; $ fileExtension = end ( $ filenameParts ) ; $ mimeType = self :: lookupMimeType ( $ fileExtension ) ; } // Set the mime type for the upload request. $ fs -> setContentType ( $ mimeType ) ; // Send the data to the server. return $ this -> insertDocument ( $ fs , $ uri ) ; }
Upload a local file to create a new Google Document entry.

@param string $fileLocation The full or relative path of the file to
be uploaded.
@param string $title The name that this document should have on the
server. If set, the title is used as the slug header in the
POST request. If no title is provided, the location of the
file will be used as the slug header in the request. If no
mimeType is provided, this method attempts to determine the
mime type based on the slugHeader by looking for .doc,
.csv, .txt, etc. at the end of the file name.
Example value: 'test.doc'.
@param string $mimeType Describes the type of data which is being sent
to the server. This must be one of the accepted mime types
which are enumerated in SUPPORTED_FILETYPES.
@param string $uri (optional) The URL to which the upload should be
made.
Example: 'https://docs.google.com/feeds/documents/private/full'.
@return Zend_Gdata_Docs_DocumentListEntry The entry for the newly
created Google Document.
Upload a local file to create a new Google Document entry .