diff --git a/public/index.html b/public/index.html index ac236f5..6609ff6 100644 --- a/public/index.html +++ b/public/index.html @@ -1083,12 +1083,14 @@ async function uploadHTTP(files) { try { const presigned = await api('POST','/api/presigned',{filename:item.name,prefix:selectedPrefix,contentType:item.file.type||'application/octet-stream'}); if (!presigned.success) throw new Error(presigned.error||'Failed to get presigned URL'); + // Use the content type the server signed — browser file.type may differ for broadcast formats + const signedType = presigned.contentType || item.file.type || 'application/octet-stream'; await new Promise((resolve,reject) => { const xhr=new XMLHttpRequest(); xhr.open('PUT',presigned.url); - xhr.setRequestHeader('Content-Type',item.file.type||'application/octet-stream'); + xhr.setRequestHeader('Content-Type',signedType); xhr.upload.onprogress=e=>{ if(e.lengthComputable){ const p=Math.round(e.loaded/e.total*100); document.getElementById(`progbar-${idx}`).style.width=p+'%'; setFileStatus(idx,'uploading',p+'%'); } }; - xhr.onload=()=>xhr.status<300?resolve():reject(new Error(`S3 ${xhr.status}`)); + xhr.onload=()=>xhr.status<300?resolve():reject(new Error(`S3 error ${xhr.status}`)); xhr.onerror=()=>reject(new Error('Network error')); xhr.send(item.file); });