通过Axios分段上传-后端CXF

时间:2019-05-07 13:21:33

标签: reactjs file-upload axios cxf

我有一个React应用,它使用axios和表单数据将文件上传到后端。 后端资源通过cxf接受mulitpart。 当我尝试上传.xlsx时,出现以下异常。有指针吗?

org.apache.poi.openxml4j.exceptions.InvalidFormatException:程序包应包含内容类型部分[M1.13]

@Consumes({ MediaType.MULTIPART_FORM_DATA, "multipart/mixed" })
    @Produces(MediaType.TEXT_PLAIN)
    @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
    @Path("" +
            "/orders")
    public Response getOrders(
            @Multipart("files") List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments)
            throws ParseException, javax.mail.internet.ParseException {

[更新] 找到了问题。问题是由于我们两次在代码中读取流。我们标记并重置了流以实现此目的。

0 个答案:

没有答案