有没有办法获取给服务器的 qqfilename 和 qquuid?

Is there a way to get the qqfilename and qquuid that was given to the server?

现在我正在使用 react-fine-uploader 将分块文件发送到服务器。我想知道我是否可以获得我上传的文件名和 uuid,因为我需要它们在组件的另一部分。我相信它们在我创建的上传器对象中,但我不确定如何获取它们。

我试过检查上传器对象,但它似乎没有显示在那里。

const uploader = new FineUploaderTraditional({
    options: {
        chunking: {
            enabled: true
        },
        deleteFile: {
            enabled: true,
            endpoint: `http://app.client.local/upload_delete`
        },
        request: {
            endpoint: `http://app.client.local/upload_chunk`
        },
        retry: {
            enableAuto: false
        }
    }
})

const isFileGone = status => {
    return [
        'canceled',
        'deleted',
    ].indexOf(status) >= 0
}

class SVFineUploaderComponent extends Component {
    constructor() {
        super()

        this.state = {
            submittedFiles: []
        }
    }

    componentDidMount() {
        uploader.on('statusChange', (id, oldStatus, newStatus) => {
            if (newStatus === 'submitted') {
                const submittedFiles = this.state.submittedFiles

                submittedFiles.push(id)
                this.setState({ submittedFiles })
            }
            else if (isFileGone(newStatus)) {
                const submittedFiles = this.state.submittedFiles
                const indexToRemove = submittedFiles.indexOf(id)

                submittedFiles.splice(indexToRemove, 1)
                this.setState({ submittedFiles })
            }
        })
    }

    renderFileInput = () => {
        return (
            <Container style={{border: "3px dotted"}}>
                <FileInput uploader={ uploader }>
                    <Dropzone uploader={ uploader }>
                        <span class="icon ion-upload">Attach or Drop Files Here</span>
                    </Dropzone>
                </FileInput>
            </Container>
        );
    }

    renderFile = () => {
        console.log(uploader)
        return (
            <Container style={{border: "3px dotted"}}>
                {
                    this.state.submittedFiles.map(id => (
                        <React.Fragment>
                            <Filename key={ id } id={ id } uploader={ uploader } />
                            <DeleteButton key={ id } id={ id } uploader={ uploader } />
                        </React.Fragment>
                    ))
                }
            </Container>
        );
    }

    render() {
        if (this.state.submittedFiles.length === 0)
            return this.renderFileInput();

        return this.renderFile();
    }
}

export default SVFineUploaderComponent;

显然,您可以通过在方法本身之前添加后缀 .methodsuploader 来使用给定的方法 here

例子

{console.log(uploader.methods.getName(id))}
{console.log(uploader.methods.getFile(id))}
{console.log(uploader.methods.getUuid(id))}