function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ashmi PatelAshmi Patel 

cant upload file from salforce to drive

i cant upload file from salesforce to google drive. This is my code for uploading file.

 public PageReference DriveUploadAuth()
    document.AuthorId = UserInfo.getUserId();
    document.FolderId = UserInfo.getUserId();
            insert document;
    catch(DMLException e){
    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
      return null;
    finally {
      document.body = null; // clears the viewstate
      document = new Document();
         PageReference pg = new PageReference(GoogleDriveAuthUri (key , redirect_uri)) ;
         return pg;
         ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully'));
         return null;     

it will redirect me. bt I cant upload documents on google drive
need help