1 year ago
#373213
Hmr Walid
how can upload image and video with cloudinary
const Profile = () => {
const [file, setFile] = useState("");
const send = async (event) => {
const data = new FormData();
data.append("file", file);
data.append("upload_preset", "*****");
await axios
.post("https://api.cloudinary.com/v1_1/*****/upload", data)
.then((res) => console.log(res));
.catch((err)=>console.log(err)) console.log(data)
};
return (
<div className="card" style={{ marginTop: "20px", width: "500px" }}>
<form action="#">
<input
type="file"
onChange={(event) => {
const file = event.target.files[0];
setFile(file);
}}
/>
</form>
<button onClick={send}>Upload</button>
</div>
);
};
export default Profile;
I want to upload images and videos with culinary, I tried in my app but the error network but in another app, it works with the same code
javascript
reactjs
networking
cloudinary
0 Answers
Your Answer