Good afternoon guys,
I'm starting programming in react-native and I'm having a question about using forms to upload files.
Is it possible?
Thank you.
Good afternoon guys,
I'm starting programming in react-native and I'm having a question about using forms to upload files.
Is it possible?
Thank you.
You should pass the URL of something like ImagePicker or CameraRoll (which should look similar to file: ///storage/emulated/0/Pictures/shj15791-4v61-67g6-z1b6-v8451z956j5k.jpg), in formDatfollow, pass it together with the request:
const form = new FormData();
form.append('image', {
uri: "file:///...",
type: 'image/jpg',
name: 'image.jpg',
});
fetch('https://example.com/api/upload', {
method: 'POST',
body: form
});