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

前端 未结 2 1429
天涯浪人
天涯浪人 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:46

    How about ignoring python all together and just uploading directly to s3?

    You can configure your s3 bucket to disallow uploading any files larger than $X bytes.

    Here's a simple example to illustrate uploading directly to s3 (and ignoring your image width/height conditions)

    http://sente.cc/upload_to_s3.html

    code:

    
      
        
      
      
      

    refresh the page after you've submitted to see your new image


    name of key:


    http://s3.amazonaws.com/dev.sente/image.jpg

提交回复
热议问题