CameraRoll.getPhotos(fetchParams) .then((data)=> this._appendImages(data)、(e)=> console.log(e));
FormDataを使用するとき
const images = messages.map(k => {
return {
uri: k.image, //`file:///${k.image}`,
name: k.filename,
type: mime.lookup(k.filename),
}
})
console.log(images)
postData = new FormData();
postData.append('file', images);
postData.append('userid', this.user._id);
postData.append('time', moment().format('YYYY-M-D H:mm:ss'));
postData.append('group', this.groupID);
axios.post(WebAPI.url.chat.postImage,
postData,
{
headers: {
access_token: this.user.access_token,
'Content-Type': 'multipart/form-data',
},
}
).then(response => {
console.log(response.data)
}).catch(error => {
console.log(error)
})
C#はRequest.Formを取得できますが、Request.Filesを取得できません
誰が私を助けられるか ?どうもありがとうございます !
回答 1 件
関連記事
- React Nativeで変数を返す方法は?
- リアクトネイティブ:変数が定義されるまでreturn()を待たせます
- "の解析方法反応ネイティブで
- ネイティブハンドルのネストされたオブジェクトをマップとディスプレイで反応させる
- ReactNativeドロップダウンピッカーが応答しない
- AzureB2Cで保護されたNETCoreAPIにアクセスするReactアプリでアクセストークンを取得できません
- expo reactnativeで複数のチェックボックスを処理する
- ネイティブスクロールをフラットリストの一番上に反応させるonChangeText
- BorderBottomがビューの上部に追加ReactNative
- ReactNativeでのAzureMapsの使用
ああ!私のせい!
postData.append( 'file'、images);// appendファイルは1つずつでなければなりません
これに変更すると、うまくいきます!