Javascript 为什么在chrome上发生上传错误,而不是firefox?
我正在开发上传部分。 我使用dropzone插件上传文件。 如果文件很小(100MB),Javascript 为什么在chrome上发生上传错误,而不是firefox?,javascript,google-chrome,vue.js,Javascript,Google Chrome,Vue.js,我正在开发上传部分。 我使用dropzone插件上传文件。 如果文件很小(100MB), awsanp。显示此网页时出错。在chrome浏览器上出现错误。 如果我使用firefox,它运行良好,没有错误 我知道chrome的上传限制比firefox大,所以我认为应该可以。 但为什么会发生这种错误呢? 我试过隐姓埋名,但还是一样 请帮帮我 <div class="a-video-container" v-cloak ref="dropZone" :class="dropzoneClass"&
awsanp。显示此网页时出错。
在chrome浏览器上出现错误。
如果我使用firefox,它运行良好,没有错误
我知道chrome的上传限制比firefox大,所以我认为应该可以。
但为什么会发生这种错误呢?
我试过隐姓埋名,但还是一样
请帮帮我
<div class="a-video-container" v-cloak ref="dropZone" :class="dropzoneClass">
<div class="video-placeholder" v-show="!upload && video.api_id==''" @click="opeFileSelector()">
<i class="fa fa-file-video icon"></i>
Drag n Drop video file here to upload
<div class="alert alert-warning mtm">
Upload Video.
</div>
<input type="file" class="hidden" ref="fileInput"
@change="uploadFileInput()"/>
</div>
<div class="progress-layer" v-show="upload">
Uploading @{{ progress }}%
<div class="progress-ring"></div>
Preview not available
<br/>
<button class="btn btn-link"
@click="cancelUpload()">cancel</button>
</div>
<div class="progress" v-show="upload">
<div class="progress-bar progress-bar-striped active"
role="progressbar"
aria-valuemin="0"
aria-valuemax="100"
v-bind:style="{width: progress + '%'}">
</div>
<div class="title under">
Uploading @{{ file.name }} | @{{
Math.ceil(file.size/1024/1024) }}Mb
</div>
<div class="title top" v-bind:style="{width: progress + '%'}">
Uploading @{{ file.name }} | @{{
Math.ceil(file.size/1024/1024) }}Mb
</div>
</div>
</div>
<script>
...
uploadFileInput(e) {
this.startUpload(event.target.files[0]);
},
startUpload(file) {
this.upload = true;
this.file = file;
let CancelToken = axios.CancelToken;
this.cancelSource = CancelToken.source();
this.getBase64(file).then(data => {
let params = {
name: this.video.title || 'test',
description: this.video.description || 'test',
notifications: [],
file: {
name: file.name,
data: data
},
preview: {
start: this.video.preview_start,
end: this.video.preview_end
}
}
let config = {
cancelToken: this.cancelSource.token,
onUploadProgress: progressEvent => {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
this.progress = percentCompleted;
}
}
axios.post(this.endpoint + '/api/media', params, config).then(response => {
this.video.api_id = response.data.tmp_filename;
this.upload = false;
this.progress = 0;
console.log(this.video.api_id);
});
});
},
...
</script>
将视频文件拖放到此处以上载
上传视频。
正在上载@{{progress}}%
预览不可用
取消
上传{{file.name}}{{124;
Math.ceil(file.size/1024/1024)}}Mb
上传{{file.name}}{{124;
Math.ceil(file.size/1024/1024)}}Mb
...
上传文件输入(e){
这个.startUpload(event.target.files[0]);
},
启动加载(文件){
this.upload=true;
this.file=文件;
让CancelToken=axios.CancelToken;
this.cancelSource=CancelToken.source();
这个.getBase64(文件).then(数据=>{
设params={
名称:this.video.title | |“test”,
description:this.video.description | |“测试”,
通知:[],
文件:{
name:file.name,
数据:数据
},
预览:{
开始:this.video.preview\u开始,
结束:this.video.preview\u结束
}
}
让配置={
cancelToken:this.cancelSource.token,
onUploadProgress:progressEvent=>{
var percentCompleted=Math.round((progressEvent.loaded*100)/progressEvent.total)
这个进度=完成百分比;
}
}
post(this.endpoint+'/api/media',params,config)。然后(response=>{
this.video.api_id=response.data.tmp_文件名;
this.upload=false;
这个进度=0;
console.log(this.video.api_id);
});
});
},
...
调试看不见的代码真的很难……这就是代码错误吗?不是chrome配置或策略?在提出问题之前,请参考以下内容:不一定是代码错误,但如果我们有一些代码可以开始测试,它会更容易。收集更多诊断信息: