Skip to content
Advertisement

Tag: axios

Handling PHP response with Axios/React Native

I’m a React Native beginner, please excuse basic questions. I’m having trouble handling json returned from PHP in react native using axios get. My php returns (have tried both with and without headers part, and also tried with/without json_encode): My react native function is below (with the part I’m trying to get to work commented out) The console.log seems to

React app not sending files to php server with Ajax

I’m hosting a react app on my apache server. I’m using react-images-upload npm package to receive an image from the user then post it to my php server with Axios. However when I check the php $_FILES array in the response it’s empty. I have tested wether my server can receive files with a little upload form on the php

upload image to server modifying name

I am building a form with laravel 5.6 and where I save a name and a user photo, but i need the photo to be stored with the username. I show the code of my store I can get the username with $request->nombre; but I don’t know how to assign that name to the photo Answer There is a ->storeAs()

CORS issue in codeigniter 4: Response to preflight request doesn’t pass access control check

I’m making an api with Codeigniter 4 for a react application. Everything works fine in postman but when I make requests with axios (also tried fetch), it gets CORS error Access to XMLHttpRequest at ‘http://localhost:8080/testpost’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the

Advertisement