itinance / react-native-fs

Native filesystem access for react-native
MIT License
4.91k stars 961 forks source link

[Error: The file “IMG-7018.mov” couldn’t be opened because there is no such file.] #1183

Open faizkhan7896 opened 1 year ago

faizkhan7896 commented 1 year ago

I am trying to uploading a video in IOS through RNFS then it's throwing this error Screenshot 2023-04-25 at 12 07 45 PM

const urlComponents = video?.uri.split('/'); const fileNameAndExtension = urlComponents[urlComponents.length - 1]; const destPath = ${RNFS.TemporaryDirectoryPath}/${fileNameAndExtension}; await RNFS.copyFile(video?.uri, destPath);

    console.log('file://' + destPath);
    body.append('video', {
      name: 'video.mp4',
      uri: 'file://' + destPath,
      type: video.type,
    });