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

通過介面上傳文件

發布時間: 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));
}
});

熱點內容
在jsp中使用資料庫 發布:2024-03-29 19:29:01 瀏覽:786
dns伺服器江川區ip地址 發布:2024-03-29 18:47:53 瀏覽:328
sql統計百分比 發布:2024-03-29 18:47:14 瀏覽:692
javatoolsfor 發布:2024-03-29 18:17:55 瀏覽:900
linuxi2c驅動 發布:2024-03-29 18:09:56 瀏覽:672
junit源碼下載 發布:2024-03-29 18:00:10 瀏覽:526
本田雅閣壓縮機不工作 發布:2024-03-29 17:59:13 瀏覽:601
溯源碼可以偽造嗎 發布:2024-03-29 17:54:45 瀏覽:57
北京編程傳 發布:2024-03-29 17:54:44 瀏覽:436
編程畫曲線 發布:2024-03-29 17:48:59 瀏覽:60