React native 使用dropzone将本机文件上载到flask

React native 使用dropzone将本机文件上载到flask,react-native,flask,fetch,React Native,Flask,Fetch,嗨,我想用React native将文件上传到flask服务器 我使用fetch函数发送了一个文件,并收到了响应。但是打印(request.files)结果不可变MultiDict([])如何在服务器中查看我的文件?我检查状态是否正确,并得到响应{'state':'ff'} 自然反应 pressSumbitButtom() { var formData = new FormData() formData.append('file', this.state.

嗨,我想用React native将文件上传到flask服务器 我使用fetch函数发送了一个文件,并收到了响应。但是打印(request.files)结果不可变MultiDict([])如何在服务器中查看我的文件?我检查状态是否正确,并得到响应{'state':'ff'}

自然反应

    pressSumbitButtom() {
        var formData = new FormData()
        formData.append('file', this.state.file)
        return fetch('http://127.0.0.1:8000/file/', {
            method: 'POST',
            headers: {
                'Content-Type': 'multipart/form-data',
            },
            body: formData
        }).then(res =>
            res.json()
        ).then(data => console.log(data))
    }
App.py

@app.route("/file/", methods=['GET', 'POST'])
@cross_origin(origin='*', headers=['Contect-Type'])
def get_filepath() :
    response = jsonify({'state':'ee'})
    if request.method == 'POST' :
        print('response: ',response, 'request: ', request)
        print(request.files)
        response= jsonify({'state':'ff'})
        return response
    return response