我希望每个人都会做得很好,我正在使用uppyjs文件uplaoding,我想在本地存储文件或我的谷歌驱动器但我不能,我发现以下代码但它上传到 tus 目录,Tus不允许我更改端点,建议我解决。
import React, { Component } from "react";
const Uppy = require("uppy/lib/core");
const { Dashboard } = require("uppy/lib/react");
const Tus = require('uppy/lib/plugins/Tus');
const GoogleDrive = require('uppy/lib/plugins/GoogleDrive');
export default class UppyComp extends Component {
componentWillMount() {
this.host = "localhost:5000";
this.uppy = new Uppy({
autoProceed: false,
restrictions: {
maxFileSize: 10000000,
maxNumberOfFiles: 30,
minNumberOfFiles: 1,
allowedFileTypes: false
},
onBeforeFileAdded: (currentFile) => {
console.log("i am going to add file to dashboard", currentFile);
},
onBeforeUpload: files => {
console.log("i am going to upload files", files);
}
})
.use(GoogleDrive, {
host: 'http://localhost:3020'
})
.use(Tus, {
endpoint: 'https://master.tus.io/files/', // tus endpoint here
resume: true,
autoRetry: true,
retryDelays: [0, 1000, 3000, 5000]
})
.on("upload", data => {
console.log("uploading file:", data);
})
.on("file-removed", file => {
console.log("removing", file);
})
.on("complete", result => {
console.log("failed ", result.failed);
console.log("Success ", result.successful);
})
.on("upload-success", (file, resp, uploadURL) => {
console.log("upload successful, uploadUrl is", uploadURL);
})
.run(); //run uppy
}