May be this is a duplicate question but I didn't get any successful answer for me.
I am trying to upload some file to google drive. It getting successfully upload but the file name is remain "Untitled". Here is bellow what I have tried in curl and python requests
curl
curl -X POST -H 'Content-Type:*/*'
-H 'Authorization: Bearer <The access token>'
-H 'Content-Length:125'
--upload-file 'foo.txt'
'https://www.googleapis.com/upload/drive/v2/files?uploadType=multipart'
-d '{"title":"foo.txt","description":"test file"}'
Here while trying with Content-Type:multipart/related; boundary="foo_bar_baz"
its throwing error saying "use multipart" while trying only "multipart" its saying to use "/" . Any how file is getting uploaded but name is "Untitled"
Here is bellow same thing in python request:
upload_files = requests.post(
'https://www.googleapis.com/upload/drive/v2/files?uploadType=multipart',
headers={'Authorization':'Bearer {}'.format(access_token),
'Content-Type':'*/*',
'Content-Length':file_size},
data={"title":file_name,
"mimeType": "*/*",
"parents": [{"id":"root"}],
"description": "mypdf.pdf"},
files={'file':file},
)
Please dont downvote it, if I did a silly mistake, instead put a comment. I will check it. Here In my situation I cant use google drive client Thanks a lot for giving time to check my problem.