當前位置:首頁 » 文件管理 » 通過介面上傳文件

通過介面上傳文件

發布時間: 2023-06-08 16:28:09

A. APICloud 社區api.ajax介面多個文件上傳怎麼傳參

通過post請求上傳,有兩種方式,跟form表單通過file標簽提交文件是一樣的。
1、一種是鍵值對的方式,也就是一個name對應一個file:
api.ajax({
url: 'http://host/upLoad',
method: 'post',
report:true,//回調上傳進度
data: {
files: {
file1: '/sdcard/a.png',
file2: '/sdcard/b.png',
file3: '/sdcard/信搭c.png',
}
}
}, function(ret, err) {
if (ret) {
console.log(JSON.stringify(ret));
} else {
console.log(JSON.stringify(err));
}
});

2、另外一種是上傳文件數組,這種方式你的游坦畢伺服器要配合做特殊的處理進行支持:
api.ajax({
url: 'http://host/upLoad',
method: 'post',
report:true,/神芹/回調上傳進度
data: {
files: {
images: ['/sdcard/a.png', '/sdcard/b.png', '/sdcard/c.png']
}
}
}, function(ret, err) {
if (ret) {
console.log(JSON.stringify(ret));
} else {
console.log(JSON.stringify(err));
}
});

熱點內容
ubuntu搭建samba伺服器 發布:2025-02-07 05:52:54 瀏覽:54
小型企業網如何配置可以互通 發布:2025-02-07 05:33:56 瀏覽:243
09年crv哪個配置好 發布:2025-02-07 05:17:31 瀏覽:555
nvm源碼編譯 發布:2025-02-07 05:13:19 瀏覽:126
防偽碼查詢源碼 發布:2025-02-07 05:09:39 瀏覽:769
安卓機的通知在哪裡 發布:2025-02-07 05:09:01 瀏覽:282
密碼74是什麼意思 發布:2025-02-07 05:02:10 瀏覽:47
蘋果es瀏覽器無法連接ftp 發布:2025-02-07 04:59:57 瀏覽:285
javaa和a 發布:2025-02-07 04:58:24 瀏覽:64
應用鎖的密碼在哪裡查 發布:2025-02-07 04:47:25 瀏覽:507