Skip to content

Image Uploading with apollo  #938

@DeekshaApptunix

Description

@DeekshaApptunix

I need to upload user image at signup time, Here is my code
let name = UUID().uuidString
if let imageData = userImgVew.image?.jpegData(compressionQuality: 0.7) {
let file = GraphQLFile(fieldName: "(name).png", originalName: "(name)", mimeType: "image/jpeg", data:imageData)

apollo.perform(mutation:UpdateUserProfileMutation.init(userId:id, userImage:file, userDetail: userDict))

I am getting following error :

Cannot convert value of type 'GraphQLFile' to expected argument type 'String?'

I also tried it with upload method
let name = UUID().uuidString
if let imageData = userImgVew.image?.jpegData(compressionQuality: 0.7) {
let file = GraphQLFile(fieldName: "(name).png", originalName: "(name)", mimeType: "image/jpeg", data:imageData)
let uploadData = UpdateUserProfileMutation(userId:id, userImage:file.fieldName, userDetail: userDict)
apollo.upload(operation:uploadData,files:[file]){ result in

I am getting following error :

createReadStream is not a function

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions