Back

Error uploading videos to storage

  • 0
  • Web
  • Storage
  • Cloud
bolar pear
2 Sep, 2024, 18:25

Whenever I try to upload videos to my storage, I get an error saying my origin has been blocked by CORS policy and it fails to upload my video. This occurs exactly at one minute of upload time so I'm thinking it has to do with how long the upload is taking/how big the file size is. My max upload size set on my bucket is 5 GB and the mp4 files I'm trying to upload are around 50 mb. My uploading works fine when upload pictures, so I believe it has something to do with the file size of the mp4 files. I read that with larger file sizes, I need to break the file down into chunks in order for it to upload properly, but supposedly the SDK already does this for you so I'm not sure how to fix this. Also, this only occurs on Google Chrome on my PC, uploading works on my laptop with Google Chrome and it works on my PC with Microsoft Edge, but it fails on my PC when I use Google Chrome. Here is my code for uploading a file (it is very basic):

export async function uploadFile(file: File) { try { const uploadedFile = await storage.createFile( appWriteConfig.storageId, ID.unique(), file ); return uploadedFile; } catch (error) { console.log(error); } }

TL;DR
Error occurs when uploading videos to storage due to CORS policy issue leading to failure exactly at one minute mark, potentially related to file size. Troubleshoot by checking CORS configuration, ensure proper chunking of files, and refer to browser compatibility. Consider updating CORS settings and checking file chunking in SDK for a solution.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more