0

hello i wanted to upload images and files in graphene , i am bit confused here in what i want to do... here is my code below seems like its not working i installed package graphene file upload

schema.py

class Users_Type(DjangoObjectType):

class Meta:
    model = Users
    fields = '__all__'

class Users_mutation(graphene.Mutation):

class Arguments:
    name = graphene.String()
    password = graphene.String()
    image = Upload()

users = graphene.Field(Users_Type)

def mutate(cls,info,name,image,password):
    user = Users(username=name,password=password,user_profile=image)
    user.save()

    return Users_mutation(users=user)

Under main mutation class

create_user = Users_mutation.Field()

my main goal is to upload files and images , pls tell me how to do it and neccassary string that need to be put in mutation... Help would be appreciated

  • 1
    See https://stackoverflow.com/questions/49503756/how-can-i-upload-and-download-files-with-graphene-django/49516843#49516843 -- especially the note about using a standard Django upload instead at the end, which is my recommendation. – Mark Chackerian Jun 05 '21 at 13:38

0 Answers0