Django upload image - From a form to Rackspace/S3 with no manipulation

前端 未结 2 1400
天涯浪人
天涯浪人 2021-01-19 01:10

I simply want to upload an image (JPG) using a form, then send that image to Rackspace \'Cloud Files\' or Amazon \'S3\'.

  • No manipulating the file.
  • No
2条回答
  •  情话喂你
    2021-01-19 01:47

    Sorted out. Found a simpler elegant approach and feel stupid for not getting to it earlier.

    file = request.FILES["item_photo"]
    file_name = "%s/%s" % (id, '600.jpeg')
    put_file(container, file_name, file.read())
    

提交回复
热议问题