RonRadtke/react-native-blob-util

Upload Video [Error: The operation couldn’t be completed. Message too long]

NguyenHoangMinhkkkk opened this issue · 3 comments

Hi !

i have this problem when trying to upload video from iOS simulator.
it normally working fine with small videos then the problem come randomly on larger video
as Example video the uploadProgress() still giving progress before error occurs

"react-native-blob-util": "^0.19.9"
"react-native": "0.68.7"

here is my code:

        const responseMediaLibraryPicker = await ImageCropPicker.openPicker({
          mediaType: 'video',
          multiple: false,
        });
        
        const { uri, type } = responseMediaLibraryPicker
    
        RNFetchBlob.fetch(
            'PUT', // 'PUT' not 'POST'
            UPLOAD_URL, // https url
            {
               'Content-Type': type, // this is "video/mp4"
            },
            RNFetchBlob.wrap( decodeURI( is_IOS ? uri.replace('file://', '') :  uri ) ),
          )
          .uploadProgress((sent: number, total: number) => {
             // set state to render IU upload percentage
          })
          .then(() => {
              // set state to render IU upload successed
          })
          .catch(err => {
            console.log(err); // error here
          });
Screen.Recording.2024-05-22.at.16.08.19.mov

Screenshot on console debug of Xcode
Screenshot 2024-05-22 at 16 26 39

Make sure the server that receives the video is able to handle big files. Usually there is a size limit like a few megabytes.

That's usually an error on server side, like the server not accepting big files

I'm ok with the issue as it only happen on ios simulator. Everything working fine with real devices for both dev/prod env