Uploading image to S3 on Postman works but it doesn't work when I use React Native Image PickerHide keyboard in react-nativeWhat is the difference between using constructor vs getInitialState in React / React Native?What is the difference between React Native and React?React Native file upload with Rails APIImage Upload with React Native, Expo ImagePicker, Rails, Axios and PaperclipPick file from storage in react nativeHow to upload the image to firebase after reducing Image size react nativeHow to upload images from React Native App directly to Cloudinary using Attachinary in a Rails APIReact Native - Image picker with images from online?Upload images from React Native to LoopBack

Infeasibility in mathematical optimization models

Should I take out a personal loan to pay off credit card debt?

Does the length of a password for Wi-Fi affect speed?

Was there ever a difference between 'volo' and 'volo'?

Is there a loss of quality when converting RGB to HEX?

Can a PC attack themselves with an unarmed strike?

Will a paper be retracted if a flaw in released software code invalidates its central idea?

Colleagues speaking another language and it impacts work

Does bottle color affect mold growth?

How would a family travel from Indiana to Texas in 1911?

Look mom! I made my own (Base 10) numeral system!

Is multiplication of real numbers uniquely defined as being distributive over addition?

Does the United States guarantee any unique freedoms?

Why do private jets such as Gulfstream fly higher than other civilian jets?

Erratic behavior by an internal employee against an external employee

What are good ways to improve as a writer other than writing courses?

Does the Voyager team use a wrapper (Fortran(77?) to Python) to transmit current commands?

Scripting a Maintenance Plan in SQL Server Express

Validation and verification of mathematical models

Is this cheap "air conditioner" able to cool a room?

Is it true that control+alt+delete only became a thing because IBM would not build Bill Gates a computer with a task manager button?

Looking for a new job because of relocation - is it okay to tell the real reason?

Ampacity of Conductive Tape

English - Acceptable use of parentheses in an author's name



Uploading image to S3 on Postman works but it doesn't work when I use React Native Image Picker


Hide keyboard in react-nativeWhat is the difference between using constructor vs getInitialState in React / React Native?What is the difference between React Native and React?React Native file upload with Rails APIImage Upload with React Native, Expo ImagePicker, Rails, Axios and PaperclipPick file from storage in react nativeHow to upload the image to firebase after reducing Image size react nativeHow to upload images from React Native App directly to Cloudinary using Attachinary in a Rails APIReact Native - Image picker with images from online?Upload images from React Native to LoopBack






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















My Rails API seems to be working fine, when I POST an image to S3 via postman.
However, when I use React Native image picker, I don't think I'm sending the parameters in the correct way.



I am currently sending the image uri as the image parameter (the uri of the image picked from the image picker). Should I be sending something else as the image parameter?



Here is a part of my async function to make a POST request to the Visions table:



 let access_token = this.state.accessToken
try {
let response = await fetch('https://prana-app.herokuapp.com/v1/visions/',
method: 'POST',
headers:
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-User-Email': this.state.email,
'X-User-Token': this.state.accessToken
,
body: JSON.stringify(
vision:
description: 'YOYOYOYOYO',
image: this.state.uploadFile

)
);


In this case, this.state.uploadfile is the response.uri that I am getting when I pick an image from Image picker, which is formatted like:



file:///Users/ozgecokyasar/Library/Developer/CoreSimulator/Devices/EDD6C498-DACD-433E-B96D-3A30BAE7BA6D/data/Containers/Data/Application/B549F09A-EB40-4D9A-B8A8-B003362BE49D/Library/Caches/ExponentExperienceData/%2540anonymous%252Fmanifestation-react-3ac1cbe2-549f-49e7-8506-ef29638d1643/ImagePicker/28EAA390-F814-4A80-A188-8592B642BEFA.jpg



I am getting a 500 error:



ActionView::Template::Error (to_model delegated to attachment, but attachment is nil):










share|improve this question
























  • FYR: github.com/react-native-community/react-native-image-picker/…

    – Horst
    Mar 27 at 5:52











  • thank you! @Horst

    – Ozge Cokyasar
    Apr 6 at 21:01


















1















My Rails API seems to be working fine, when I POST an image to S3 via postman.
However, when I use React Native image picker, I don't think I'm sending the parameters in the correct way.



I am currently sending the image uri as the image parameter (the uri of the image picked from the image picker). Should I be sending something else as the image parameter?



Here is a part of my async function to make a POST request to the Visions table:



 let access_token = this.state.accessToken
try {
let response = await fetch('https://prana-app.herokuapp.com/v1/visions/',
method: 'POST',
headers:
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-User-Email': this.state.email,
'X-User-Token': this.state.accessToken
,
body: JSON.stringify(
vision:
description: 'YOYOYOYOYO',
image: this.state.uploadFile

)
);


In this case, this.state.uploadfile is the response.uri that I am getting when I pick an image from Image picker, which is formatted like:



file:///Users/ozgecokyasar/Library/Developer/CoreSimulator/Devices/EDD6C498-DACD-433E-B96D-3A30BAE7BA6D/data/Containers/Data/Application/B549F09A-EB40-4D9A-B8A8-B003362BE49D/Library/Caches/ExponentExperienceData/%2540anonymous%252Fmanifestation-react-3ac1cbe2-549f-49e7-8506-ef29638d1643/ImagePicker/28EAA390-F814-4A80-A188-8592B642BEFA.jpg



I am getting a 500 error:



ActionView::Template::Error (to_model delegated to attachment, but attachment is nil):










share|improve this question
























  • FYR: github.com/react-native-community/react-native-image-picker/…

    – Horst
    Mar 27 at 5:52











  • thank you! @Horst

    – Ozge Cokyasar
    Apr 6 at 21:01














1












1








1








My Rails API seems to be working fine, when I POST an image to S3 via postman.
However, when I use React Native image picker, I don't think I'm sending the parameters in the correct way.



I am currently sending the image uri as the image parameter (the uri of the image picked from the image picker). Should I be sending something else as the image parameter?



Here is a part of my async function to make a POST request to the Visions table:



 let access_token = this.state.accessToken
try {
let response = await fetch('https://prana-app.herokuapp.com/v1/visions/',
method: 'POST',
headers:
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-User-Email': this.state.email,
'X-User-Token': this.state.accessToken
,
body: JSON.stringify(
vision:
description: 'YOYOYOYOYO',
image: this.state.uploadFile

)
);


In this case, this.state.uploadfile is the response.uri that I am getting when I pick an image from Image picker, which is formatted like:



file:///Users/ozgecokyasar/Library/Developer/CoreSimulator/Devices/EDD6C498-DACD-433E-B96D-3A30BAE7BA6D/data/Containers/Data/Application/B549F09A-EB40-4D9A-B8A8-B003362BE49D/Library/Caches/ExponentExperienceData/%2540anonymous%252Fmanifestation-react-3ac1cbe2-549f-49e7-8506-ef29638d1643/ImagePicker/28EAA390-F814-4A80-A188-8592B642BEFA.jpg



I am getting a 500 error:



ActionView::Template::Error (to_model delegated to attachment, but attachment is nil):










share|improve this question














My Rails API seems to be working fine, when I POST an image to S3 via postman.
However, when I use React Native image picker, I don't think I'm sending the parameters in the correct way.



I am currently sending the image uri as the image parameter (the uri of the image picked from the image picker). Should I be sending something else as the image parameter?



Here is a part of my async function to make a POST request to the Visions table:



 let access_token = this.state.accessToken
try {
let response = await fetch('https://prana-app.herokuapp.com/v1/visions/',
method: 'POST',
headers:
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-User-Email': this.state.email,
'X-User-Token': this.state.accessToken
,
body: JSON.stringify(
vision:
description: 'YOYOYOYOYO',
image: this.state.uploadFile

)
);


In this case, this.state.uploadfile is the response.uri that I am getting when I pick an image from Image picker, which is formatted like:



file:///Users/ozgecokyasar/Library/Developer/CoreSimulator/Devices/EDD6C498-DACD-433E-B96D-3A30BAE7BA6D/data/Containers/Data/Application/B549F09A-EB40-4D9A-B8A8-B003362BE49D/Library/Caches/ExponentExperienceData/%2540anonymous%252Fmanifestation-react-3ac1cbe2-549f-49e7-8506-ef29638d1643/ImagePicker/28EAA390-F814-4A80-A188-8592B642BEFA.jpg



I am getting a 500 error:



ActionView::Template::Error (to_model delegated to attachment, but attachment is nil):







react-native amazon-s3 image-uploading rails-activestorage react-native-image-picker






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 5:47









Ozge CokyasarOzge Cokyasar

401 silver badge6 bronze badges




401 silver badge6 bronze badges















  • FYR: github.com/react-native-community/react-native-image-picker/…

    – Horst
    Mar 27 at 5:52











  • thank you! @Horst

    – Ozge Cokyasar
    Apr 6 at 21:01


















  • FYR: github.com/react-native-community/react-native-image-picker/…

    – Horst
    Mar 27 at 5:52











  • thank you! @Horst

    – Ozge Cokyasar
    Apr 6 at 21:01

















FYR: github.com/react-native-community/react-native-image-picker/…

– Horst
Mar 27 at 5:52





FYR: github.com/react-native-community/react-native-image-picker/…

– Horst
Mar 27 at 5:52













thank you! @Horst

– Ozge Cokyasar
Apr 6 at 21:01






thank you! @Horst

– Ozge Cokyasar
Apr 6 at 21:01













0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55370564%2fuploading-image-to-s3-on-postman-works-but-it-doesnt-work-when-i-use-react-nati%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55370564%2fuploading-image-to-s3-on-postman-works-but-it-doesnt-work-when-i-use-react-nati%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript