I am currently working on a movie streaming app, and I need to upload larger files (e.g 1GB and above).
when I upload smaller files like 1MB to 90MB it works fine but when I tried to upload 100MB+ I get this browser error Access to XMLHttpRequest at 'https://myurl.com/uploadVideo' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. I don't what else to do. Here my code below.
const handleFullVideoUpload =async(e) =>{
let fullVideoFile = e.target.files[0];
setFullVideo(fullVideoFile);
const fullVideoData = new FormData();
fullVideoData.append("video", fullVideoFile);
setLoading(true);
//Upload video
try{
let {data} = await axios.post(`myUrl/uploadVideo`, fullVideoData,
{
onUploadProgress: (e)=>{
let percent = Math.floor((100 * e.loaded) /e.total)
console.log('Percent', percent)
}
}
);
}catch(err){
console.log(err)
}
}