go - 如何修复 Go 中的 "zip: not a valid zip file"错误?

标签 go

我是 Golang 的新手。我用 a link读取 xlsx 文件:

    filePath := "controllers\\foo.xlsx"
xlFile, err := xlsx.OpenFile(filePath)
if err != nil {
    log.Fatal(err)
}

我的程序在window os 上运行。
提前致谢。

最佳答案

用这个 :

    file, fileHeader, err := req.FormFile("theAttachmentfile")

    if err != nil {
      do what you wanna do
    }

    xlsx, err := excelize.OpenReader(file)
    if err != nil {
      do what you wanna do
    }

关于go - 如何修复 Go 中的 "zip: not a valid zip file"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55832497/

相关文章:

go - 在反引号字符串中添加字符串插值

go - 反射(reflect) (MethodByName) 无效

logging - 堆栈跟踪作为字符串

go - 如何跨 goroutines 共享 map

go - 双破折号停止标志解析

go - 通过 GoCQL 在 ScyllaDB 上进行阻塞/一致/可预测的回复/请求

git - 如何通过 SSH 在 CI 构建成功上部署我的 webapp?

mongodb - 无法使用带有 golang 的 mgo 检索 "_id"值

go - 如何导出名称以便全局访问?

go - 如何将 interface{} 转换为 []int?