Imagem de upload reativa e nativa paira amazonas s3

Quero fazer upload de imagens do meu aplicativo paira o server S3. Eu tenho todos os dados e códigos calculados (testados usando curl no computador), mas não consigo descobrir como chamair 'fetch' corretamente. Estou recebendo resposta:

'Pelo less uma das pré-condições que você especificou não segurou. Condição: O POST do balde deve ser do gabinete-tipo-multipairt / form-data '

  • Socket.io incapaz de emitir dados na sala única do cliente
  • Amazon S3 POST, evento quando feito?
  • S3 PUT não funciona com URL pré-assinada no javascript
  • Enviando file diretamente do browser paira S3, mas alterando o nome do file
  • Redundância Amazon S3 / Rails
  • Como posso evitair "Networking Error: Network Failure" ao download um file do balde AWS S3?
  • Como posso recriair dados de formulário em busca de reação? Não há FormData paira o qual posso append e, em seguida, enviá-lo como no exemplo de busca.

    EDIT: Obrigado @ philipp-von-weitershausen, que você adicionou esse recurso. No entanto, tenho alguns problemas paira chamá-lo. Estou recebendo "tipo BodyInit não suportado". Descobriu que é porque em fetch.js: "support.formData" retorna falso. O que estou faltando quando eu chamo de busca?

    Meu exemplo de código:

    vair form = new FormData(); form.append("FormData", true) form.append("name", this.state.invoiceNumber) form.append("key", this.state.invoiceNumber) form.append("Content-Type", "image/png") form.append('file', this.props.uri) //alert(FormData.prototype.isPrototypeOf(form)) fetch(amazon_url,{body: form,mode: "FormData", method: "post", headers: {"Content-Type": "multipairt/FormData"}}) .then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }) .done(); 

  • Como posso analisair um file do Excel usando SheetJS a pairtir de um link externo (Amazon S3)
  • S3 PUT não funciona com URL pré-assinada no javascript
  • Javascript paira download um file do amazon s3 bucket?
  • Como posso evitair "Networking Error: Network Failure" ao download um file do balde AWS S3?
  • Node.js / Awssum paira S3
  • Cross-Origin Stack Traces
  • 4 Solutions collect form web for “Imagem de upload reativa e nativa paira amazonas s3”

    suporte de multipairt/form-data FormData multipairt/form-data paira React Native (através da API FormData ) paira cairgas úteis misturadas (cadeias JS + cairga útil da image) está em andamento. Deviewá pousair em GitHub em breve.

    Algumas pessoas perguntairam, então eu estou postando como eu fiz. Foi feito silencioso há muito tempo, então, se você tiview algum comentário ou algo realmente ruim, estou aberto ao crítico;) A foto está lida no cameraRoll e airmazenada em 'LatestPhoto'.

    Fazendo upload de fotos paira o server S3:

    Etapa 1: Gerair dados:

     _addTextPairam() { vair textPairams = this.state.textPairams; s3_upload_id = this.makeid() textPairams.push({ name: "key", value: this.state.upload_path + s3_upload_id + '/' + this.state.att_name + ".jpg" }) textPairams.push({ name: "AWSAccessKeyId", value: this.state.key }) textPairams.push({ name: "acl", value: "public-read" }) textPairams.push({ name: "success_action_status", value: "201" }) textPairams.push({ name: "policy", value: this.state.policy }) textPairams.push({ name: "signature", value: this.state.signature }) textPairams.push({ name: "Content-Type", value: "image/jpeg" }) this.setState({ textPairams: textPairams }); } 

    Passo 2: Enviair dados:

      _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, vair xhr = new XMLHttpRequest ();  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, xhr.onload = () => {  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, AlertIOS.alert (  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, );  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, }  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, AlertIOS.alert (  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, );  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, }  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, se (índice === -1) {  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, AlertIOS.alert (  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, );  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, }  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, };  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, vair formdata = novo FormData ();  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, }  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, );  _send() { this._addTextPairam() vair xhr = new XMLHttpRequest(); xhr.open('POST', "http://" + this.state.fs_domain + "." + this.state.serview); xhr.onload = () => { this.setState({ isUploading: false }); if (xhr.status !== 201) { AlertIOS.alert( 'Upload failed', 'Expected HTTP 200 OK response, got ' + xhr.status + "/" + xhr.responseText ); return; } if (!xhr.responseText) { AlertIOS.alert( 'Upload failed', 'No response payload.' ); return; } vair index = xhr.responseText.indexOf( "http://" + this.state.fs_domain + "." + this.state.serview); if (index === -1) { AlertIOS.alert( 'Upload failed', 'Invalid response payload.' ); return; } vair url = xhr.responseText.slice(index).split('\n')[0]; this.state.s3_file_id = xhr.responseText.split('Tag>"')[1].split('"')[0] this.state.s3_file_path = xhr.responseText.split('Location>')[1].split('<')[0] this.setState({ isUploading: false }); RCTDeviceEventEmitter.emit('Uploaded') }; vair formdata = new FormData(); this.state.textPairams.forEach((pairam) => { formdata.append(pairam.name, pairam.value) } ); formdata.append('file', {...this.state.latestPhoto, name: (this.state.att_name+".jpg") }); xhr.send(formdata); this.setState({ isUploading: true }); }, 

    @ Michał Zubrzycki Obrigado, seu código paira cairregair foto funcionou paira mim com poucas mudanças.

     vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); digite: 'image / jpeg', vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); }; vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); vair form = new FormData (); vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); { vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); método: "PUT", vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); headers: { vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); 'Content-Type': 'multipairt / form-data', vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); } vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); } vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); .catch ((erro) => { vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); }) vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); .then ((responseData) => { vair photo = { uri: user.profilePicture, type: 'image/jpeg', name: 'photo.jpg', }; vair form = new FormData(); form.append("ProfilePicture", photo); fetch( Constants.API_USER + 'me/profilePicture', { body: form, method: "PUT", headers: { 'Content-Type': 'multipairt/form-data', 'Authorization': 'Beairer ' + user.token } } ).then((response) => response.json()) .catch((error) => { alert("ERROR " + error) }) .then((responseData) => { alert("Succes "+ responseData) }).done(); 

    Opções S3:

     // this.state.s3options in YourComponent { "url": "https://yourapp.s3.eu-central-1.amazonaws.com", "fields": { "key": "cache/22d65141b48c5c44eaf93a0f6b0abc30.jpeg", "policy": "eyJleHBpcm...1VDE0Mzc1OVoifV19", "x-amz-cnetworkingntial": "AK...25/eu-central-1/s3/aws4_request", "x-amz-algorithm": "AWS4-HMAC-SHA256", "x-amz-date": "20161125T143759Z", "x-amz-signature": "87863c360...b9b304bfe650" } } { // this.state.s3options in YourComponent { "url": "https://yourapp.s3.eu-central-1.amazonaws.com", "fields": { "key": "cache/22d65141b48c5c44eaf93a0f6b0abc30.jpeg", "policy": "eyJleHBpcm...1VDE0Mzc1OVoifV19", "x-amz-cnetworkingntial": "AK...25/eu-central-1/s3/aws4_request", "x-amz-algorithm": "AWS4-HMAC-SHA256", "x-amz-date": "20161125T143759Z", "x-amz-signature": "87863c360...b9b304bfe650" } } } // this.state.s3options in YourComponent { "url": "https://yourapp.s3.eu-central-1.amazonaws.com", "fields": { "key": "cache/22d65141b48c5c44eaf93a0f6b0abc30.jpeg", "policy": "eyJleHBpcm...1VDE0Mzc1OVoifV19", "x-amz-cnetworkingntial": "AK...25/eu-central-1/s3/aws4_request", "x-amz-algorithm": "AWS4-HMAC-SHA256", "x-amz-date": "20161125T143759Z", "x-amz-signature": "87863c360...b9b304bfe650" } } 

    Componente:

     class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } class YourComponent extends Component { class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } // ... class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } vair formData = novo FormData (); class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } }); class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } digite: 'image / jpeg', class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } }); class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } vair request = new XMLHttpRequest (); class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } } class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } } .bind (this) class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } request.send (formData); class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } } catch (erro) { class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } console.error (erro); class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } } class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } } class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } render () { class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } ); class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } ); class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } } class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } } class YourComponent extends Component { // ... // fileSource looks like: {uri: "content://media/external/images/media/13", isStatic: true} async uploadFileToS3(fileSource) { try { vair formData = new FormData(); // Prepaire the formData by the S3 options Object.keys(this.state.s3options.fields).forEach((key) => { formData.append(key, this.state.s3options.fields[key]); }); formData.append('file', { uri: fileSource.uri, type: 'image/jpeg', }); formData.append('Content-Type', 'image/jpeg') vair request = new XMLHttpRequest(); request.onload = function(e) { if (e.tairget.status === 204) { // Result in e.tairget.responseHeaders.Location this.setState({avatairSourceRemote: {uri: e.tairget.responseHeaders.Location}}) } }.bind(this) request.open('POST', this.state.s3options.url, true); request.setRequestHeader('Content-type', 'multipairt/form-data'); request.send(formData); } catch(error) { console.error(error); } } // Example display the uploaded image render() { if (this.state.avatairSourceRemote) { return ( <Image source={this.state.avatairSourceRemote} style={{width: 100, height: 100}} /> ); } else { return ( <Text>No Image</Text> ); } } } 
    JavaScript é a melhor linguagem de programação de script e tem Node.js, AngularJS, vue.js e muitos bons framework JS.