numandev1 / react-native-compressor

🗜️Compress Image, Video, and Audio same like Whatsapp 🚀✨
MIT License
940 stars 87 forks source link

Can't upload compressed video to the server #38

Closed qburst-subins closed 2 years ago

qburst-subins commented 3 years ago

I am getting compressed video file path as "file://data/user/0/com.ikonikgolf.ikonik/cache/88a6b03a-23c2-4810-9158-15be29c99105.mp4", When I tried to upload this file as a multipart form. I am getting No network error.

I can upload the original video file with URI : content://com.miui.gallery.open/raw/%2Fstorage%2Femulated%2F0%2FDCIM%2FCamera%2FVID_20210904_102656.mp4

Error: Network Error at createError (createError.js:16) at EventTarget.handleError (xhr.js:84) at EventTarget.dispatchEvent (event-target-shim.js:818) at EventTarget.setReadyState (XMLHttpRequest.js:575) at EventTarget.didCompleteResponse (XMLHttpRequest.js:389) at XMLHttpRequest.js:502 at RCTDeviceEventEmitter.emit (EventEmitter.js:189) at MessageQueue.callFunction (MessageQueue.js:425) at MessageQueue.js:112 at MessageQueue.__guard (MessageQueue.js:373)

numandev1 commented 3 years ago

@subinsuresh did you verify, compressed video file exists or is not on that path?

moowoonsunghoon commented 2 years ago

@nomi9995 I have a same issue! how to check vedio file exists?

moowoonsunghoon commented 2 years ago

i fixed it!! After compression, path need to change from file:// to file:///!

numandev1 commented 2 years ago

@moowoonsunghoon @subinsuresh now you can also use the background Upload function from the compressor package. it also support binary and multipart requests

https://github.com/Shobbak/react-native-compressor#background-upload

image