1

I need to upload files on Django project with Graphene, but files can not be saved to the space. I am using Digitalocean space to store files, if i upload any file via Django Admin Panel, i can see the file on the space but my below mutation function is missed. I can see the file name on the database but the file is not saved to the storage area.

What function should i add to save file i can not find any way.

Thanks in advance

class UploadImage(relay.ClientIDMutation):
    class Input:
        name = graphene.String(required=True)

    new_image = graphene.Field(ImageNode)

    @classmethod
    def mutate_and_get_payload(cls, root, info, **input):
        image = Image()
        check_and_set_field(input, image, "name")
        image.save()

        uploaded_img = info.context.FILES
        
        return UploadImage(new_image=image)
Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
Khan Khan
  • 119
  • 9

0 Answers0