第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

當(dāng)我想獲取 formData 時(shí),POST 轉(zhuǎn)換為 GET 嗎?

當(dāng)我想獲取 formData 時(shí),POST 轉(zhuǎn)換為 GET 嗎?

蝴蝶刀刀 2021-10-29 16:33:03
我想將圖像發(fā)送到服務(wù)器我的代碼在 Chrome 版本 77.0.3865.90 中完美運(yùn)行但在 Mozilla Firefox(版本 69.0.1)中,POST 方法更改為 GET 并出現(xiàn)此錯(cuò)誤表單包含一個(gè)文件輸入,但在表單上缺少 method=POST 和 enctype=multipart/form-data。不會(huì)發(fā)送文件。請(qǐng)求地址:http://localhost:3000/ ...請(qǐng)求方式:GET狀態(tài)碼:200<form class="form-horizontal" id="form" ><div class="col"> <label for="images" class="control-label">image</label> <input type="file" class="form-control" name="images" id="images" ></div><div class="form-group row">   <div class="col">        <button type="submit" class="btn btn-danger">Send</button>   </div></div></form><script>document.getElementById('form').addEventListener('submit' , async function(event) {let images = document.querySelector('input[name="images"]');let formData = new FormData();formData.append('images' , images.files[0] );try {         const response = await fetch('http://exampleurl.com/profile', {             method: 'POST',             headers: {               'X-Requested-With': 'XMLHttpRequest',               'X-CSRF-Token': "<%= req.csrfToken() %>",             },             body: formData,             credentials: 'same-origin'             });             } catch (error) {               console.error(error);    }    })</script>我不能在表單中使用 method ="POST" 和 enctype="multipart/form-data" 因?yàn)閏srf 令牌不能在帶有 multipart/form-data enctype 的表單中實(shí)現(xiàn)
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 312 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)