I have the following:
fil = file:///storage/emulated/0/Android/data/com.test/files/Pictures/7601d776-7ca4-44b0-99cf-d8c0bb4c14e9.jpg
, (Image.path
for android Generated by react-native-image-crop-picker
. when I use the below code to send this to the backend, it has an error with cloudinary while the Image.path
for IOS fil = /Users/test/Library/Developer/CoreSimulator/Devices/.../data/Containers/Data/Application/.../tmp/react-native-image-crop-picker/.../.jpg
does not have an error. Why is this the cases since they are both grabbed from Image.path
for react-native-image-crop-picker
?
const res = await client.post('/upload-avatar',{fil},{headers:{
Accept : 'application/json',
authorization: 'some JWT'
}})
back end:
try{
const upload_result = await cloudinary.uploader.upload(req.body.fil, {
public_id: `${user._id}_profile`,
width:500,
height:500,
crop: 'fill'
})
res.status(201).json({success:true,message: "good"})
}catch (error){
res.status(500).json({success:false,message: "Error"})
}