我有java服务器端的网站。
当用户提交表单时,我希望应用程序从表单输入中获取文本,并将其作为.txt文件上载到
我的
谷歌驱动器帐户。
我可以将文本从客户端传输到服务器端。
我可以从文本创建一个文件。
我无法使用有效的access_令牌获取文件并将其上载到我的google驱动器,因为我不知道如何执行post请求。
我试过的却没有运气:
File file = new File ("omer.txt");
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost("https://www.googleapis.com/upload/drive/v3/files?uploadType=media");
//add reuqest header
con.setRequestMethod("POST");
httpPost.setHeader("Content-Type", "text/plain");
httpPost.setHeader("Authorization", "Bearer " + access_token);
//execute the post request and upload the file to my google drive using the access token
//execute the post request and upload the file to my google drive using the access token
那么:如何使用有效的access_令牌将txt文件上载到google驱动器?