Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This is Python Flask code, which will be hosted in Digital Ocean Droplet
- @app.route('/', methods=['POST'])
- def upload_file():
- file = request.files['file']
- # Is it possible to eliminate this step???
- file.save('/tmp/file.ext')
- session = boto3.session.Session()
- client = session.client('s3',
- region_name='nyc3',
- endpoint_url='https://nyc3.digitaloceanspaces.com',
- aws_access_key_id='ACCESS_KEY',
- aws_secret_access_key='SECRET_KEY'
- )
- client.upload_file('/tmp/file.ext', # Path to local file
- 'my-space', # Name of Space
- 'file.ext') # Name for remote file
Add Comment
Please, Sign In to add comment