gpt4 book ai didi

jquery - 如何通过 Google 脚本在云端硬盘的文件夹内创建文件夹?

转载 作者:太空宇宙 更新时间:2023-11-04 16:08:38 24 4
gpt4 key购买 nike

我使用现有的文件夹 ID 上传文件,但我喜欢在用户按下提交按钮时按用户名创建文件夹。请看看我的 form 。帮我解决这个问题。

JS:

var dropBoxId = "123454567567"; // Drive ID of 'dropbox' folder
var logSheetId = "xoxoxoxooxoxox"; // Drive ID of log spreadsheet

function doGet(e) {
return HtmlService.createHtmlOutputFromFile('InputForm.html');
}

function uploadFiles(formObject) {
try {
// Create a file in Drive from the one provided in the form
var folder = DriveApp.getFolderById(dropBoxId);
var person = createFolder(ajith);
var blob1 = formObject.myFile1;
var blob2 = formObject.myFile2;
var blob3 = formObject.myFile3;
var file1 = person.createFile(blob1);
var file2 = person.createFile(blob2);
var file3 = person.createFile(blob3);
file.setDescription("Uploaded by " + formObject.myName);

// Open the log and record the new file name, URL and name from form
var ss = SpreadsheetApp.openById(logSheetId);
var sheet = ss.getSheets()[0];
sheet.appendRow([formObject.myName, formObject.myEmail, formObject.myCert, formObject.myExp, formObject.mySkills, formObject.myFees, formObject.myLoc, formObject.myTravel, file1.getName(),file2.getName(),file3.getName(), file1.getUrl(),file2.getUrl(),file3.getUrl(), file.getDateCreated() ]);

// Return the new file Drive URL so it can be put in the web app output
return file.getUrl();
} catch (error) {
return error.toString();
}
}
HTML:
<form>
<h2 class="text-center title">Application Form</h2>
<div class="col-sm-6" id="myForm">
<div><label>Name:</label><input type="text" name="myName" placeholder="Your full name..." required/></div>
<div><label>Mobile Number:</label><input type="number" name="myNum" placeholder="Mobile number..." required/></div>
<div><label>Email:</label><input type="email" name="myEmail" placeholder="Email ID..." required/></div>
<div><label>Certificate:</label><input type="text" name="myCert" placeholder="Certificate Name..." required/></div>
<div><label>Experience:</label><input type="number" name="myExp" placeholder="Experience in years..." required/></div>
<div><label>Skills:</label><input type="text" name="mySkills" placeholder="Skills(seperate by comma).." required/></div>
</div>
<div class="col-sm-6" id="myForm">
<div><label>Fees:</label><input type="text" name="myFees" placeholder="Fees..." required/></div>
<div><label>Locality:</label><input type="text" name="myLoc" placeholder="Locality..." required/></div>
<div><label>Willingness to travel:</label><select><option>Yes</option><option>No</option></select></div>
<div><label>Attach your latest Photo 1</label><input name="myFile1" type="file" required/></div>
<div><label>Attach your latest Photo 2</label><input name="myFile2" type="file" required/></div>
<div><label>Attach your latest Photo 3</label><input name="myFile3" type="file" required/></div>
</div>
<input type="button" class="btn btn-success" value="Submit"
onclick="google.script.run
.withSuccessHandler(updateUrl)
.withFailureHandler(onFailure)
.uploadFiles(this.parentNode)" />
</form>

<div id="output"></div>

最佳答案

尝试这样的事情

 var name ="Myfoldernanme";
var newfolder = folder.createFolder(name);

关于jquery - 如何通过 Google 脚本在云端硬盘的文件夹内创建文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36130999/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com