-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multipart request (FormData) not work in iOS #67
Comments
hi @canhtran10 ! it looks good, will need more information to debug it. maybe you can send the full request to my email. |
@MaxToyberman i have sent an email to you, please take a look :) |
@canhtran10 i saw the video, i know what is the problem. you are attaching an image. The reason is iOS limitations, i can explain why. please try to convert is first and tell me if it works :) |
@canhtran10 do you use react-native-image-picker ? |
@MaxToyberman yes, I am using react-native-image-picker: 0.26.7 |
@canhtran10 so in iOS image picker response had data property in it and then :
https://github.com/react-native-community/react-native-image-picker#usage please let me know |
@canhtran10 did you check ? |
okie let you know when i have done the checking |
@MaxToyberman Besides, I am using the react-native-document-picker library to upload a document file and it's not working too. There is no data field in DocumentPicker: have a nice day :) |
@canhtran10 can you try to use this branch ? if it works i will release a new version Have a great day :) |
ok @MaxToyberman i will be trying tomorrow, hope it works :) |
@MaxToyberman it is not working. I am preparing for a new app release, maybe have to exclude the upload function when using react-native-ssl-pinning, and will implement again in the next release. Please take a look at this issue. |
@canhtran10 uploaded another fix, please try: (yarn upgrade the same branch)
|
@canhtran10 did you add 'data:image/jpeg;base64,' ? if so remove it |
still having the same issue |
@canhtran10 @castalonirenz i have just upload some files i know what was the issue :
2)data: response.data is not needed i will update the docs. your code should look like this : let formData = new FormData();
let dataObj = {
name: a.name,
type: 'image/jpg',
uri: a.uri
};
formData.append('file', dataObj); // i tested with "file" parametter but its still not work
formData.append('groupRecipients', JSON.stringify(message.GroupRecipients));
formData.append('userRecipients', JSON.stringify(message.UserRecipients));
let response = fetch(url, {
method: "POST" ,
timeoutInterval: 30000,
body: {
formData: formData,
},
sslPinning: {
certs: ["mycert1"]
}
}) Please let me know if it worked for you |
@canhtran10 @castalonirenz please try it on latest version 1.5.1 |
Will try it on monday @MaxToyberman thanks |
@canhtran10 @castalonirenz did you check it ? |
@MaxToyberman i have a question does it automatically set the header to formData even though there is no formData set on the headers? |
@castalonirenz yes |
so both IOS and ANDROID the request will be automatically set to multipart/form-data? so no headers at all to bet set just to be clear |
@castalonirenz you don't need multipart/form-data headers, both on android and iOS |
Thanks, will try it tomorrow for sure. |
@castalonirenz @canhtran10 please reopen if needed |
Hi @MaxToyberman here is the issue without including Multipart on the header |
let params = {
|
@castalonirenz can you show me your formData ? |
|
with Android it's working perfectly, i don't understand why it's not working in iOS (all ios version), don't have any parameters transfer to the API server:
THE LOG REQUEST IN SERVER:
Files: "" ; group receipents: "" ; User receipients: ""
The CODE:
The LOG API REQUEST:
Please take a look and let me know if you have anything solution for that. Thanks :)
The text was updated successfully, but these errors were encountered: