gpt4 book ai didi

android - 将图像与 Android 中的 JSON 数据一起上传到 Multipart 中的服务器

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:40:22 24 4
gpt4 key购买 nike

我正在尝试将图像连同从表单收集的一些 JSON 数据上传到服务器。

服务器有身份验证。

METHOD: post

HEADERS:

Authorization Basic d2Vic2VydmljZTpyM05hdTE3Rw==

Content-Type multipart/form-data;boundary=xxxxxxxx

BODY:

--xxxxxxxx

Content-Disposition: form-data; name="jsonFile"
Content-Type: application/json

{"model":"Premium","deviceLongitude":4.79337638,"pseudo":"nickname","deviceLatitude":45.7671507,"year":"2005","email":"email@mail.com","deviceLocale":"fr_FR","title":"my picture"}

--xxxxxxxx

Content-Disposition: form-data; name="imgName"
Content-Type: image/jpeg

//Image data array

/9j/4AAQSkZJRgABAQAAAQABAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAAB
AAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAB4KAD
AAQAAAABAAACgAAAAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEB
AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
AQEBAQEBAQH/wAARCAKAAeADAREAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAA
AAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF
--xxxxxxxx

最佳答案

最后一行应该是--xxxxxxxx--,而不是--xxxxxxxx

关于android - 将图像与 Android 中的 JSON 数据一起上传到 Multipart 中的服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5416038/

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