I'm trying to set up file upload using flask and then transfer the file to google drive.
It works most of the time but occasionally the transfer to google drive will hang after uploading the file using flask. The problem only occurs with larger files and not every time.
filename = secure_filename(file.filename)
filename=str(time.time()).replace('.','_')+'_____' + filename
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
file_metadata = {'name': displayName,
'parents': [foldertID] }
media = MediaFileUpload('/var/flocation/' + filename)
Gfile = service.files().create(body=file_metadata,
media_body=media,
fields='id').execute()
fileID=Gfile.get('id')
os.remove(os.path.join(app.config['UPLOAD_FOLDER'], filename))
Is there a problem with the file not completely being uploaded before starting the transfer to goggle drive? There is no error message, it just hangs. If I resubmit the upload request, it usually fixes the problem.
Thanks for the help.