Skip to content

Upload multiple image issue #1264

@HardikKardani

Description

@HardikKardani

Hello

I am trying to upload user profile picture and cover photo using below code..

issue:- every time i am getting json formate error and status code 400. but if i only upload single photo and other image as nill then it works fine.

if let imageData = imgProfilePicture.image!.jpegData(compressionQuality: 0.7){
            let fileFieldName   = "pic"
            let file            = GraphQLFile(fieldName: fileFieldName, originalName: "fileFieldName.jpg", mimeType: "image/jpg", data: imageData)
            
            let imageCoverData = imgCoverPhoto.image!.jpegData(compressionQuality: 0.7)
            let coverPhotoFieldName   = "coverPhoto"
            let coverPhotoFile            = GraphQLFile(fieldName: coverPhotoFieldName, originalName: "coverPhoto.jpg", mimeType: "image/jpg", data: imageCoverData!)
            
            Network.shared.apollo.upload(operation: UpdateUserMutation(email:"test@gmail.com", pic: "0", coverPhoto: "1"), files: [file, coverPhotoFile])
}

is there any issue in passing data or what?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions