我正在做一个反应项目,就像一个社交媒体应用程序,用户可以上传图片或视频。我使用Firebase存储存储图像和视频。
我能够完成图像上传通过使用React firebase-文件上传包,但由于我是新的网页开发,我正在努力寻找上传视频的反应解决方案。
我已经在网上搜索过了,但是我找不到合适的解决方案来完成这些任务。
发布于 2020-05-26 12:53:07
发布于 2020-05-25 14:36:59
发布于 2021-08-28 06:11:32
你可以试试这个
<input type = "file"
onChange = {
(e) => {
let videoObj = e.currentTarget.files[0];
// console.log(videoObj)
let {
name,
size,
type
} = videoObj;
size = size / 1000000
//for not uploading the file more than 10 MB
if (size > 10) {
alert("please upload file less than 10 MB");
return;
}
//code for only uploading the video
type = type.split("/")[0];
if (type != "video") {
alert("please upload video only");
return;
}
}
}
/>https://stackoverflow.com/questions/61932443
复制相似问题