Upload File
Uploads a file from the local file system to Google Drive.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Drive Id - The identifier for the connected Google Drive service obtained from the Connect node.
- File Path - The local file path of the file to be uploaded.
- Parent Folder Id - The ID of the folder in Google Drive where the file should be uploaded.
Output
- file_id - The unique identifier of the uploaded file in Google Drive.
How It Works
The Upload File node transfers a file from the local file system to Google Drive. When executed, the node:
- Validates the required inputs (Drive Id, File Path, and Parent Folder Id)
- Retrieves the Google Drive service client using the provided Drive Id
- Opens the specified local file for reading
- Determines the MIME type of the file based on its extension
- Creates a File object with the file name and parent folder ID
- Uses the Google Drive API to upload the file with the Files.Create method and Media parameter
- Returns the ID of the newly created file in Google Drive
Requirements
- A valid Google Drive connection established using the Connect node
- A valid local file path to an existing file
- The ID of an existing folder in Google Drive where the file should be uploaded
- Appropriate permissions to create files in the specified folder
- Sufficient storage space in Google Drive
- Read permissions for the local file
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid Drive Id
- Empty or invalid File Path
- Empty or invalid Parent Folder Id
- Google Drive API errors during file upload
- Insufficient permissions to create files in the specified folder
- Insufficient storage space in Google Drive
- Unable to read the local file
- Invalid file path
Usage Notes
- The uploaded file will have the same name as the local file
- The MIME type is automatically detected based on the file extension
- If MIME type detection fails, the file will be uploaded with a generic type
- The parent folder must exist in Google Drive
- Large files may take longer to upload depending on network conditions
- The returned file_id can be used in subsequent nodes to manipulate the uploaded file
- Make sure the specified local file exists and is readable
- The uploaded file will be placed directly in the specified parent folder