{"action":"created","issue":{"url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/1","labels_url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/1/comments","events_url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/1/events","html_url":"https://github.com/marcshilling/react-native-image-picker/issues/1","id":90836888,"number":1,"title":"Upload through fetch","user":{"login":"mschipperheyn","id":384959,"avatar_url":"https://avatars.githubusercontent.com/u/384959?v=3","gravatar_id":"","url":"https://api.github.com/users/mschipperheyn","html_url":"https://github.com/mschipperheyn","followers_url":"https://api.github.com/users/mschipperheyn/followers","following_url":"https://api.github.com/users/mschipperheyn/following{/other_user}","gists_url":"https://api.github.com/users/mschipperheyn/gists{/gist_id}","starred_url":"https://api.github.com/users/mschipperheyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mschipperheyn/subscriptions","organizations_url":"https://api.github.com/users/mschipperheyn/orgs","repos_url":"https://api.github.com/users/mschipperheyn/repos","events_url":"https://api.github.com/users/mschipperheyn/events{/privacy}","received_events_url":"https://api.github.com/users/mschipperheyn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-25T03:01:06Z","updated_at":"2015-08-12T18:09:43Z","closed_at":null,"body":"Any suggestions on uploading an image to a server using fetch?"},"comment":{"url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/comments/130396666","html_url":"https://github.com/marcshilling/react-native-image-picker/issues/1#issuecomment-130396666","issue_url":"https://api.github.com/repos/marcshilling/react-native-image-picker/issues/1","id":130396666,"user":{"login":"sorenbs","id":281337,"avatar_url":"https://avatars.githubusercontent.com/u/281337?v=3","gravatar_id":"","url":"https://api.github.com/users/sorenbs","html_url":"https://github.com/sorenbs","followers_url":"https://api.github.com/users/sorenbs/followers","following_url":"https://api.github.com/users/sorenbs/following{/other_user}","gists_url":"https://api.github.com/users/sorenbs/gists{/gist_id}","starred_url":"https://api.github.com/users/sorenbs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorenbs/subscriptions","organizations_url":"https://api.github.com/users/sorenbs/orgs","repos_url":"https://api.github.com/users/sorenbs/repos","events_url":"https://api.github.com/users/sorenbs/events{/privacy}","received_events_url":"https://api.github.com/users/sorenbs/received_events","type":"User","site_admin":false},"created_at":"2015-08-12T18:09:43Z","updated_at":"2015-08-12T18:09:43Z","body":"Here's my approach if anyone is curious:\r\n\r\nvar options = {\r\n      title: 'Upload image',\r\n      cancelButtonTitle: 'Cancel',\r\n      takePhotoButtonTitle: 'Take Photo...',\r\n      chooseFromLibraryButtonTitle: 'Choose from Library...',\r\n      returnBase64Image: true,\r\n      returnIsVertical: false\r\n    };\r\nUIImagePickerManager.showImagePicker(options, (type, response) => {\r\n      if (type !== 'cancel') {\r\n        var source;\r\n        if (type === 'data') { \r\n          source = {uri: 'data:image/jpeg;base64,' + response, isStatic: true};\r\n        } else { \r\n          source = {uri: response};\r\n        }\r\n\r\n        console.log(\"uploading image\");\r\n\r\n         fetch('my-server-endpoint',{\r\n           method: 'post',\r\n           body: \"data=\" + encodeURIComponent(source.uri)\r\n         }).then(response => {\r\n           console.log(\"image uploaded\")\r\n           console.log(response)\r\n         }).catch(console.log);\r\n\r\n        //this.setState({avatarSource:source});\r\n      } else {\r\n        console.log('Cancel');\r\n      }\r\n    });\r\n\r\nSimply use decodeURIComponent on the server to get the image data"}}