Hi Team,
I am trying to upload file on google drive using api Powershell script.
file get added on google drive but file name is not comming its come Untitled,
also not able to view the upladed file
what is an issue
Here is my script
# Web API endpoint URL
$apiUrl = %Google%
# Input file path
$inputFilePath = "C:\Users\sanket.shinde\Downloads\Krishna.png"
# API token
$apiToken = "provided"
$fileName = "Demo"
try {
# Create a WebClient object
$webClient = New-Object System.Net.WebClient
# Set the Authorization header with the API token
$webClient.Headers.Add("Authorization", "Bearer $apiToken")
# Upload the file using multipart/form-data
$responseBytes = $webClient.UploadFile($apiUrl, "POST", $inputFilePath)
Write-Output "file saved successfully."
}
catch {
Write-Output "An error occurred: $_"
}

Report
All responses (
Answers (