Flask: Uploading pdfs to google drive using its API
for file in files:
filemetadata = {
'name' : securefilename(file.filename),
'parents' : folder_id
}
#f = io.BytesIO(file)
media = MediaFileUpload(file, mimetype = 'application/pdf')
drive.service.files().create(
body = filemetadata,
mediabody = media,
fields = 'id'
).execute()
So here's the part that I can't figure out. What is basically happening is that I have a form that takes in a list of pdf files (max 5 mb for each of those files) but what I can't figure out is how to upload those files to the google drive folder. I
/r/flask
https://redd.it/13gcndv
for file in files:
filemetadata = {
'name' : securefilename(file.filename),
'parents' : folder_id
}
#f = io.BytesIO(file)
media = MediaFileUpload(file, mimetype = 'application/pdf')
drive.service.files().create(
body = filemetadata,
mediabody = media,
fields = 'id'
).execute()
So here's the part that I can't figure out. What is basically happening is that I have a form that takes in a list of pdf files (max 5 mb for each of those files) but what I can't figure out is how to upload those files to the google drive folder. I
/r/flask
https://redd.it/13gcndv
Reddit
r/flask on Reddit: Flask: Uploading pdfs to google drive using its API
Posted by u/Seandara - 3 votes and 2 comments