美文网首页初见
Moya上传带参数的图片

Moya上传带参数的图片

作者: dlxfly | 来源:发表于2020-01-05 10:13 被阅读0次

    日期2020.1.5

    let formatter = DateFormatter()
    formatter.dateFormat = "yyyyMMddHHmmss"
    let fileName = "\(formatter.string(from: Date()))"+".png"
    let formData = MultipartFormData(provider: .data(Data), name: "pic",fileName: fileName, mimeType: "image/png")
    //主要是这一步把value 转成Data格式
    let formData2 = MultipartFormData(provider: .data("value".data(using: String.Encoding.utf8)!), name: "key")
    let multipartData = [formData, formData2]
    return .uploadMultipart(multipartData)
    

    相关文章

      网友评论

        本文标题:Moya上传带参数的图片

        本文链接:https://www.haomeiwen.com/subject/fnyqactx.html