启用并发分块后,应用程序会向您选择的端点发送最终 POST 请求,让您知道上传已完成。我想对所有请求使用相同的端点(不仅仅是最终的并发分块 POST),但我没有看到 POST 有什么真正独特的地方。例如,在文档中是这样说的:
Fine Uploader will also include the following parameters that describe the underlying file:
qquuid: the UUID of the underlying file. qqfilename: the name of the underlying file. qqtotalfilesize: the size, in bytes, of the underlying file. qqtotalparts: the total number of parts that make up the underlying file.
但是所有这些项目都是与其他 POST 请求一起发送的标准值。我可以在 if/then 类型的语句中捕捉到最终的 POST 有什么独特之处吗?现在我让它根据是否是多部分 POST 来工作。如果是,它应该包含文件数据,如果不是,它应该是最终消息。是否有另一个指标可以让我检查它?就像专门说“并发分块完成?”
它对我来说确实有效,但按照我的方式来做似乎很老套。
最佳答案
如果您希望将“所有 block 完成”POST 发送到同一端点,但需要一种简单的方法来区分该请求和上传请求,只需在 URL 末尾包含一个查询参数即可。
例如:
request: {
endpoint: "/my/uploads"
},
chunking: {
enabled: true,
success: {
endpoint: "/my/uploads?done"
}
}
现在,您只需在请求 URI 服务器端查找是否存在“done”参数即可判断 POST 是否引用 chunking.success POST。
关于javascript - 精细 uploader 并发分块 - 端点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24499748/